| ... | ... | @@ -14899,7 +14899,10 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s |
| 14899 | 14899 | bool is_comptime; |
| 14900 | 14900 | if (!ir_resolve_comptime(ira, peer_parent->is_comptime->child, &is_comptime)) |
| 14901 | 14901 | return ira->codegen->invalid_instruction; |
| 14902 | | if (is_comptime) return nullptr; |
| 14902 | peer_parent->skipped = is_comptime; |
| 14903 | if (peer_parent->skipped) { |
| 14904 | return nullptr; |
| 14905 | } |
| 14903 | 14906 | |
| 14904 | 14907 | if (peer_parent->resolved_type == nullptr) { |
| 14905 | 14908 | ResultLocPeer *last_peer = &peer_parent->peers[peer_parent->peer_count - 1]; |
| ... | ... | @@ -14916,6 +14919,7 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s |
| 14916 | 14919 | { |
| 14917 | 14920 | return parent_result_loc; |
| 14918 | 14921 | } |
| 14922 | result_loc->written = true; |
| 14919 | 14923 | result_loc->resolved_loc = parent_result_loc; |
| 14920 | 14924 | return result_loc->resolved_loc; |
| 14921 | 14925 | } |
| ... | ... | @@ -16385,16 +16389,15 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh |
| 16385 | 16389 | } |
| 16386 | 16390 | |
| 16387 | 16391 | ResultLocPeerParent *peer_parent = phi_instruction->peer_parent; |
| 16388 | | if (peer_parent != nullptr && peer_parent->resolved_type == nullptr) { |
| 16389 | | bool is_comptime; |
| 16390 | | if (!ir_resolve_comptime(ira, peer_parent->is_comptime->child, &is_comptime)) |
| 16391 | | return ira->codegen->invalid_instruction; |
| 16392 | | if (is_comptime) goto skip_peer_stuff; |
| 16393 | | |
| 16392 | if (peer_parent != nullptr && peer_parent->resolved_type == nullptr && !peer_parent->skipped) { |
| 16394 | 16393 | // Suspend the phi first so that it gets resumed last |
| 16395 | | IrSuspendPosition suspend_pos; |
| 16396 | | ira_suspend(ira, &phi_instruction->base, nullptr, &suspend_pos); |
| 16397 | | ira->resume_stack.append(suspend_pos); |
| 16394 | ira->resume_stack.add_one(); |
| 16395 | for (size_t i = ira->resume_stack.length;;) { |
| 16396 | if (i <= 1) break; |
| 16397 | i -= 1; |
| 16398 | ira->resume_stack.items[i] = ira->resume_stack.items[i-1]; |
| 16399 | } |
| 16400 | ira_suspend(ira, &phi_instruction->base, nullptr, &ira->resume_stack.items[0]); |
| 16398 | 16401 | |
| 16399 | 16402 | IrInstruction **instructions = allocate<IrInstruction *>(peer_parent->peer_count); |
| 16400 | 16403 | for (size_t i = 0; i < peer_parent->peer_count; i += 1) { |
| ... | ... | @@ -16427,7 +16430,6 @@ static IrInstruction *ir_analyze_instruction_phi(IrAnalyze *ira, IrInstructionPh |
| 16427 | 16430 | |
| 16428 | 16431 | return ira_resume(ira); |
| 16429 | 16432 | } |
| 16430 | | skip_peer_stuff: |
| 16431 | 16433 | |
| 16432 | 16434 | ZigList<IrBasicBlock*> new_incoming_blocks = {0}; |
| 16433 | 16435 | ZigList<IrInstruction*> new_incoming_values = {0}; |
| ... | ... | @@ -24598,6 +24600,9 @@ ZigType *ir_analyze(CodeGen *codegen, IrExecutable *old_exec, IrExecutable *new_ |
| 24598 | 24600 | continue; |
| 24599 | 24601 | } |
| 24600 | 24602 | |
| 24603 | if (ira->codegen->verbose_ir) { |
| 24604 | fprintf(stderr, "analyze #%zu\n", old_instruction->debug_id); |
| 24605 | } |
| 24601 | 24606 | IrInstruction *new_instruction = ir_analyze_instruction_base(ira, old_instruction); |
| 24602 | 24607 | if (new_instruction != nullptr) { |
| 24603 | 24608 | ir_assert(new_instruction->value.type != nullptr || new_instruction->value.type != nullptr, old_instruction); |