aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-06-17 13:31:19 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-06-17 13:31:19 -0400
commitb025193de5b951734e5108e4762e5dc40359431b (patch)
tree4b29d27c03bbf6604964276ad01d35aab010540e /src/codegen.cpp
parent9564c05cd5641095d48baf982a372f00bdf02659 (diff)
downloadzig-b025193de5b951734e5108e4762e5dc40359431b.tar.gz
zig-b025193de5b951734e5108e4762e5dc40359431b.zip
inferred comptime values rather than elided scopes
because of this example: ```zig export fn entry(b: bool) usize { var runtime = [1]i32{3}; comptime var i: usize = 0; inline while (i < 2) : (i += 1) { const result = if (i == 0) [1]i32{2} else runtime; } comptime { return i; } } ``` The problem is that the concept of "resetting" a result location, introduced in the previous commit, cannot handle elision scopes. This concept is inherently broken with inline loops.
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 4c212c95ab..547840514a 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -722,7 +722,6 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) {
case ScopeIdCompTime:
case ScopeIdCoroPrelude:
case ScopeIdRuntime:
- case ScopeIdElide:
return get_di_scope(g, scope->parent);
}
zig_unreachable();
@@ -5761,12 +5760,10 @@ static void ir_render(CodeGen *g, ZigFn *fn_entry) {
if (instruction->ref_count == 0 && !ir_has_side_effects(instruction))
continue;
- if (!scope_is_elided(instruction->scope)) {
- if (!g->strip_debug_symbols) {
- set_debug_location(g, instruction);
- }
- instruction->llvm_value = ir_render_instruction(g, executable, instruction);
+ if (!g->strip_debug_symbols) {
+ set_debug_location(g, instruction);
}
+ instruction->llvm_value = ir_render_instruction(g, executable, instruction);
}
current_block->llvm_exit_block = LLVMGetInsertBlock(g->builder);
}