stage2: codegen: fix crash
I forgot to do -Denable-qemu -Denable-wasmtime when testing yesterday, sorry about that. In reuseOperand, the code assumed a re-used register would be tracked in the register table but that is not always the case.
This commit is contained in:
@@ -934,8 +934,9 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type {
|
||||
// If it's in the registers table, need to associate the register with the
|
||||
// new instruction.
|
||||
const branch = &self.branch_stack.items[self.branch_stack.items.len - 1];
|
||||
const entry = branch.registers.getEntry(toCanonicalReg(reg)).?;
|
||||
entry.value = .{ .inst = inst };
|
||||
if (branch.registers.getEntry(toCanonicalReg(reg))) |entry| {
|
||||
entry.value = .{ .inst = inst };
|
||||
}
|
||||
log.debug("reusing {} => {*}", .{reg, inst});
|
||||
},
|
||||
.stack_offset => |off| {
|
||||
|
||||
Reference in New Issue
Block a user