mirror of
https://github.com/ziglang/zig.git
synced 2025-12-31 18:43:18 +00:00
IR: fix phi instruction when one of the predecessors is unreachable
This commit is contained in:
parent
b4c2f7e310
commit
43be6ccb03
@ -2268,6 +2268,7 @@ static void analyze_fn_body(CodeGen *g, FnTableEntry *fn_table_entry) {
|
||||
if (block_return_type->id == TypeTableEntryIdInvalid ||
|
||||
fn_table_entry->analyzed_executable.invalid)
|
||||
{
|
||||
assert(g->errors.length > 0);
|
||||
fn_table_entry->anal_state = FnAnalStateInvalid;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6910,11 +6910,12 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP
|
||||
IrInstruction *old_value = phi_instruction->incoming_values[i];
|
||||
assert(old_value);
|
||||
IrInstruction *new_value = old_value->other;
|
||||
if (!new_value || new_value->type_entry->id == TypeTableEntryIdInvalid)
|
||||
if (!new_value || new_value->type_entry->id == TypeTableEntryIdUnreachable)
|
||||
continue;
|
||||
|
||||
if (new_value->type_entry->id == TypeTableEntryIdInvalid)
|
||||
return ira->codegen->builtin_types.entry_invalid;
|
||||
|
||||
if (new_value->type_entry->id == TypeTableEntryIdUnreachable)
|
||||
continue;
|
||||
|
||||
assert(predecessor->other);
|
||||
new_incoming_blocks.append(predecessor->other);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user