From 29bb175f4f9018bfb0e17686c05165527530de25 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 30 Dec 2016 18:47:54 -0500 Subject: IR: handle phi instruction with 0 resulting incoming values --- src/ir.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 4f3a686ba4..edb2789c5d 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -7938,7 +7938,11 @@ static TypeTableEntry *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionP new_incoming_blocks.append(predecessor->other); new_incoming_values.append(new_value); } - assert(new_incoming_blocks.length != 0); + + if (new_incoming_blocks.length == 0) { + ir_build_const_from(ira, &phi_instruction->base, false); + return ira->codegen->builtin_types.entry_void; + } if (new_incoming_blocks.length == 1) { IrInstruction *first_value = new_incoming_values.at(0); -- cgit v1.2.3