| ... | @@ -5006,14 +5006,8 @@ fn canonicaliseBranches(self: *Self, parent_branch: *Branch, canon_branch: *Bran | ... | @@ -5006,14 +5006,8 @@ fn canonicaliseBranches(self: *Self, parent_branch: *Branch, canon_branch: *Bran |
| 5006 | if (target_value == .dead) | 5006 | if (target_value == .dead) |
| 5007 | continue; | 5007 | continue; |
| 5008 | // The instruction is only overridden in the else branch. | 5008 | // The instruction is only overridden in the else branch. |
| 5009 | var i: usize = self.branch_stack.items.len - 1; | 5009 | // If integer overflows occurs, the question is: why wasn't the instruction marked dead? |
| 5010 | while (true) { | 5010 | break :blk self.getResolvedInstValue(target_key).?; |
| 5011 | i -= 1; // If this overflows, the question is: why wasn't the instruction marked dead? | | |
| 5012 | if (self.branch_stack.items[i].inst_table.get(target_key)) |mcv| { | | |
| 5013 | assert(mcv != .dead); | | |
| 5014 | break :blk mcv; | | |
| 5015 | } | | |
| 5016 | } | | |
| 5017 | }; | 5011 | }; |
| 5018 | log.debug("consolidating target_entry {d} {}=>{}", .{ target_key, target_value, canon_mcv }); | 5012 | log.debug("consolidating target_entry {d} {}=>{}", .{ target_key, target_value, canon_mcv }); |
| 5019 | // TODO make sure the destination stack offset / register does not already have something | 5013 | // TODO make sure the destination stack offset / register does not already have something |
| ... | @@ -5030,16 +5024,7 @@ fn canonicaliseBranches(self: *Self, parent_branch: *Branch, canon_branch: *Bran | ... | @@ -5030,16 +5024,7 @@ fn canonicaliseBranches(self: *Self, parent_branch: *Branch, canon_branch: *Bran |
| 5030 | log.debug("canon_value = {}", .{canon_value}); | 5024 | log.debug("canon_value = {}", .{canon_value}); |
| 5031 | if (canon_value == .dead) | 5025 | if (canon_value == .dead) |
| 5032 | continue; | 5026 | continue; |
| 5033 | const parent_mcv = blk: { | 5027 | const parent_mcv = self.getResolvedInstValue(canon_key).?; |
| 5034 | var i: usize = self.branch_stack.items.len - 1; | | |
| 5035 | while (true) { | | |
| 5036 | i -= 1; | | |
| 5037 | if (self.branch_stack.items[i].inst_table.get(canon_key)) |mcv| { | | |
| 5038 | assert(mcv != .dead); | | |
| 5039 | break :blk mcv; | | |
| 5040 | } | | |
| 5041 | } | | |
| 5042 | }; | | |
| 5043 | log.debug("consolidating canon_entry {d} {}=>{}", .{ canon_key, parent_mcv, canon_value }); | 5028 | log.debug("consolidating canon_entry {d} {}=>{}", .{ canon_key, parent_mcv, canon_value }); |
| 5044 | // TODO make sure the destination stack offset / register does not already have something | 5029 | // TODO make sure the destination stack offset / register does not already have something |
| 5045 | // going on there. | 5030 | // going on there. |