| ... | @@ -991,9 +991,14 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -991,9 +991,14 @@ fn airBlock(self: *Self, inst: Air.Inst.Index) !void { |
| 991 | const relocs = &self.blocks.getPtr(inst).?.relocs; | 991 | const relocs = &self.blocks.getPtr(inst).?.relocs; |
| 992 | if (relocs.items.len > 0 and relocs.items[relocs.items.len - 1] == self.mir_instructions.len - 1) { | 992 | if (relocs.items.len > 0 and relocs.items[relocs.items.len - 1] == self.mir_instructions.len - 1) { |
| 993 | // If the last Mir instruction is the last relocation (which | 993 | // If the last Mir instruction is the last relocation (which |
| 994 | // would just jump one instruction further), it can be safely | 994 | // would just jump two instruction further), it can be safely |
| 995 | // removed | 995 | // removed |
| 996 | self.mir_instructions.orderedRemove(relocs.pop()); | 996 | const index = relocs.pop(); |
| | 997 | |
| | 998 | // First, remove the delay slot, then remove |
| | 999 | // the branch instruction itself. |
| | 1000 | self.mir_instructions.orderedRemove(index + 1); |
| | 1001 | self.mir_instructions.orderedRemove(index); |
| 997 | } | 1002 | } |
| 998 | for (relocs.items) |reloc| { | 1003 | for (relocs.items) |reloc| { |
| 999 | try self.performReloc(reloc); | 1004 | try self.performReloc(reloc); |