aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-06-17 06:07:53 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-06-18 17:12:56 -0400
commit46b57748a52c32b973903166d40c7ebee53d88c5 (patch)
treec818d1a7fdd99bbc8eb38fae78ded8a7effffbd0 /src/codegen.cpp
parent02f688d710312a43a56a3a24b769778a5aafc5da (diff)
downloadzig-46b57748a52c32b973903166d40c7ebee53d88c5.tar.gz
zig-46b57748a52c32b973903166d40c7ebee53d88c5.zip
stage1: stop emitting memset to undefined when safety is off
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 75d126eaf6..6c3fdddfb1 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -5583,8 +5583,12 @@ static LLVMValueRef ir_render_memset(CodeGen *g, IrExecutableGen *executable, Ir
bool val_is_undef = value_is_all_undef(g, instruction->byte->value);
LLVMValueRef fill_char;
- if (val_is_undef && ir_want_runtime_safety_scope(g, instruction->base.base.scope)) {
- fill_char = LLVMConstInt(LLVMInt8Type(), 0xaa, false);
+ if (val_is_undef) {
+ if (ir_want_runtime_safety_scope(g, instruction->base.base.scope)) {
+ fill_char = LLVMConstInt(LLVMInt8Type(), 0xaa, false);
+ } else {
+ return nullptr;
+ }
} else {
fill_char = ir_llvm_value(g, instruction->byte);
}