From 43be6ccb03e6ce32f78c69129b61d49cae2b747d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 21 Dec 2016 23:04:04 -0500 Subject: IR: fix phi instruction when one of the predecessors is unreachable --- src/ir.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index ae629e0910..97d70e3e6a 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -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); -- cgit v1.2.3