| ... | @@ -4588,12 +4588,12 @@ fn finishThenElseBlock( | ... | @@ -4588,12 +4588,12 @@ fn finishThenElseBlock( |
| 4588 | } else { | 4588 | } else { |
| 4589 | _ = try else_scope.addBreak(break_tag, main_block, .void_value); | 4589 | _ = try else_scope.addBreak(break_tag, main_block, .void_value); |
| 4590 | } | 4590 | } |
| 4591 | const block_ref = parent_gz.indexToRef(main_block); | | |
| 4592 | if (strat.elide_store_to_block_ptr_instructions) { | 4591 | if (strat.elide_store_to_block_ptr_instructions) { |
| 4593 | try setCondBrPayloadElideBlockStorePtr(condbr, cond, then_scope, else_scope, block_ref); | 4592 | try setCondBrPayloadElideBlockStorePtr(condbr, cond, then_scope, else_scope, block_scope.rl_ptr); |
| 4594 | } else { | 4593 | } else { |
| 4595 | try setCondBrPayload(condbr, cond, then_scope, else_scope); | 4594 | try setCondBrPayload(condbr, cond, then_scope, else_scope); |
| 4596 | } | 4595 | } |
| | 4596 | const block_ref = parent_gz.indexToRef(main_block); |
| 4597 | switch (rl) { | 4597 | switch (rl) { |
| 4598 | .ref => return block_ref, | 4598 | .ref => return block_ref, |
| 4599 | else => return rvalue(parent_gz, parent_scope, rl, block_ref, node), | 4599 | else => return rvalue(parent_gz, parent_scope, rl, block_ref, node), |
| ... | @@ -4909,7 +4909,7 @@ fn setCondBrPayloadElideBlockStorePtr( | ... | @@ -4909,7 +4909,7 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 4909 | cond: Zir.Inst.Ref, | 4909 | cond: Zir.Inst.Ref, |
| 4910 | then_scope: *GenZir, | 4910 | then_scope: *GenZir, |
| 4911 | else_scope: *GenZir, | 4911 | else_scope: *GenZir, |
| 4912 | main_block: Zir.Inst.Ref, | 4912 | block_ptr: Zir.Inst.Ref, |
| 4913 | ) !void { | 4913 | ) !void { |
| 4914 | const astgen = then_scope.astgen; | 4914 | const astgen = then_scope.astgen; |
| 4915 | | 4915 | |
| ... | @@ -4930,7 +4930,7 @@ fn setCondBrPayloadElideBlockStorePtr( | ... | @@ -4930,7 +4930,7 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 4930 | | 4930 | |
| 4931 | for (then_scope.instructions.items) |src_inst| { | 4931 | for (then_scope.instructions.items) |src_inst| { |
| 4932 | if (zir_tags[src_inst] == .store_to_block_ptr) { | 4932 | if (zir_tags[src_inst] == .store_to_block_ptr) { |
| 4933 | if (zir_datas[src_inst].bin.lhs == main_block) { | 4933 | if (zir_datas[src_inst].bin.lhs == block_ptr) { |
| 4934 | astgen.extra.items[then_body_len_index] -= 1; | 4934 | astgen.extra.items[then_body_len_index] -= 1; |
| 4935 | continue; | 4935 | continue; |
| 4936 | } | 4936 | } |
| ... | @@ -4939,7 +4939,7 @@ fn setCondBrPayloadElideBlockStorePtr( | ... | @@ -4939,7 +4939,7 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 4939 | } | 4939 | } |
| 4940 | for (else_scope.instructions.items) |src_inst| { | 4940 | for (else_scope.instructions.items) |src_inst| { |
| 4941 | if (zir_tags[src_inst] == .store_to_block_ptr) { | 4941 | if (zir_tags[src_inst] == .store_to_block_ptr) { |
| 4942 | if (zir_datas[src_inst].bin.lhs == main_block) { | 4942 | if (zir_datas[src_inst].bin.lhs == block_ptr) { |
| 4943 | astgen.extra.items[else_body_len_index] -= 1; | 4943 | astgen.extra.items[else_body_len_index] -= 1; |
| 4944 | continue; | 4944 | continue; |
| 4945 | } | 4945 | } |