From f38d7b02f3d677c4043ec37494abbd916b1d5d99 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 5 Apr 2020 14:20:26 +0100 Subject: Fix phi node check with untyped types --- src/ir.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 2b6917d0d..b14943d23 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -1298,6 +1298,8 @@ irValue *ir_instr_if(irProcedure *p, irValue *cond, irBlock *true_block, irBlock irValue *ir_instr_phi(irProcedure *p, Array edges, Type *type) { + GB_ASSERT(is_type_typed(type)); + irValue *v = ir_alloc_instr(p, irInstr_Phi); irInstr *i = &v->Instr; i->Phi.edges = edges; @@ -7167,7 +7169,7 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) { irValue *cond = ir_build_cond(proc, te->cond, then, else_); ir_start_block(proc, then); - Type *type = type_of_expr(expr); + Type *type = default_type(type_of_expr(expr)); ir_open_scope(proc); array_add(&edges, ir_emit_conv(proc, ir_build_expr(proc, te->x), type)); @@ -7199,7 +7201,7 @@ irValue *ir_build_expr_internal(irProcedure *proc, Ast *expr) { irValue *cond = ir_build_cond(proc, te->cond, then, else_); ir_start_block(proc, then); - Type *type = type_of_expr(expr); + Type *type = default_type(type_of_expr(expr)); ir_open_scope(proc); array_add(&edges, ir_emit_conv(proc, ir_build_expr(proc, te->x), type)); -- cgit v1.2.3