diff options
| author | gingerBill <bill@gingerbill.org> | 2020-04-05 14:20:26 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-04-05 14:20:26 +0100 |
| commit | f38d7b02f3d677c4043ec37494abbd916b1d5d99 (patch) | |
| tree | d1ce7cd48975f160ec398724f5723dcc69d7c0ba /src | |
| parent | 5e706bab56eb28023d27623e0d33c4b5e06b5781 (diff) | |
Fix phi node check with untyped types
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
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<irValue *> 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)); |