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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user