From a76b048354e5754b18ecd83ad21cf45c5a34e276 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 18 Dec 2016 13:37:50 -0500 Subject: IR: phi instruction handles unreachable values correctly --- src/ir.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index c58b91f604..b215721acb 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -6493,14 +6493,18 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP if (predecessor->ref_count == 0) continue; - assert(predecessor->other); - new_incoming_blocks.append(predecessor->other); 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) return ira->codegen->builtin_types.entry_invalid; + + if (new_value->type_entry->id == TypeTableEntryIdUnreachable) + continue; + + assert(predecessor->other); + new_incoming_blocks.append(predecessor->other); new_incoming_values.append(new_value); } assert(new_incoming_blocks.length != 0); -- cgit v1.2.3