ir_instr *phi;
ir_block *cond = func->curblock;
+ ir_block *cond_out = NULL;
ir_block *ontrue, *ontrue_out = NULL;
ir_block *onfalse, *onfalse_out = NULL;
ir_block *merge;
cgen = self->cond->expression.codegen;
if (!(*cgen)((ast_expression*)(self->cond), func, false, &condval))
return false;
+ cond_out = func->curblock;
/* create on-true block */
ontrue = ir_function_create_block(ast_ctx(self), func->ir_func, ast_function_label(func, "tern_T"));
return false;
/* create if instruction */
- if (!ir_block_create_if(cond, condval, ontrue, onfalse))
+ if (!ir_block_create_if(cond_out, condval, ontrue, onfalse))
return false;
/* Now enter the merge block */