| ... | ... | @@ -10659,6 +10659,12 @@ static IrInstruction *ir_const_undef(IrAnalyze *ira, IrInstruction *source_instr |
| 10659 | 10659 | return result; |
| 10660 | 10660 | } |
| 10661 | 10661 | |
| 10662 | static IrInstruction *ir_const_unreachable(IrAnalyze *ira, IrInstruction *source_instruction) { |
| 10663 | IrInstruction *result = ir_const(ira, source_instruction, ira->codegen->builtin_types.entry_unreachable); |
| 10664 | result->value.special = ConstValSpecialStatic; |
| 10665 | return result; |
| 10666 | } |
| 10667 | |
| 10662 | 10668 | static IrInstruction *ir_const_void(IrAnalyze *ira, IrInstruction *source_instruction) { |
| 10663 | 10669 | return ir_const(ira, source_instruction, ira->codegen->builtin_types.entry_void); |
| 10664 | 10670 | } |
| ... | ... | @@ -14461,7 +14467,9 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s |
| 14461 | 14467 | if (peer_parent->resolved_type == nullptr) { |
| 14462 | 14468 | IrInstruction *suspended_inst = ira_suspend(ira, suspend_source_instr, |
| 14463 | 14469 | result_peer->next_bb, &result_peer->suspend_pos); |
| 14464 | | bool last_one = (result_peer == &peer_parent->peers[peer_parent->peer_count - 1]); |
| 14470 | bool last_one = result_peer->seen_before || |
| 14471 | result_peer == &peer_parent->peers[peer_parent->peer_count - 1]; |
| 14472 | result_peer->seen_before = true; |
| 14465 | 14473 | if (!last_one) { |
| 14466 | 14474 | return suspended_inst; |
| 14467 | 14475 | } |
| ... | ... | @@ -14472,13 +14480,20 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s |
| 14472 | 14480 | |
| 14473 | 14481 | IrInstruction *gen_instruction = this_peer->base.gen_instruction; |
| 14474 | 14482 | if (gen_instruction == nullptr) { |
| 14475 | | instructions[i] = ir_const(ira, this_peer->base.source_instruction, |
| 14476 | | this_peer->base.implicit_elem_type); |
| 14477 | | instructions[i]->value.special = ConstValSpecialRuntime; |
| 14483 | // unreachable instructions will cause implicit_elem_type to be null |
| 14484 | if (this_peer->base.implicit_elem_type == nullptr) { |
| 14485 | instructions[i] = ir_const_unreachable(ira, this_peer->base.source_instruction); |
| 14486 | } else { |
| 14487 | instructions[i] = ir_const(ira, this_peer->base.source_instruction, |
| 14488 | this_peer->base.implicit_elem_type); |
| 14489 | instructions[i]->value.special = ConstValSpecialRuntime; |
| 14490 | } |
| 14478 | 14491 | } else { |
| 14479 | 14492 | instructions[i] = gen_instruction; |
| 14480 | 14493 | } |
| 14481 | | if (opposite_peer->base.implicit_elem_type->id != ZigTypeIdUnreachable) { |
| 14494 | if (opposite_peer->base.implicit_elem_type != nullptr && |
| 14495 | opposite_peer->base.implicit_elem_type->id != ZigTypeIdUnreachable) |
| 14496 | { |
| 14482 | 14497 | ira->resume_stack.append(opposite_peer->suspend_pos); |
| 14483 | 14498 | } |
| 14484 | 14499 | } |