Allocate a temporary for 64-bit constant loads in the s390x backend (#5357)

Avoid reusing a destination virtual register for 64-bit constants in the s390x backend. This change addresses a case identified by the regalloc2 ssa validator, as the destination register was written to twice when constants were generated via the MachInst::gen_constant function.
This commit is contained in:
Trevor Elliott
2022-11-30 17:01:14 -08:00
committed by GitHub
parent 0e65f87e37
commit c16f2956db
2 changed files with 14 additions and 8 deletions

View File

@@ -104,7 +104,7 @@ pub fn mem_finalize(
} else {
let tmp = writable_spilltmp_reg();
assert!(base != tmp.to_reg());
insts.extend(Inst::load_constant64(tmp, off as u64));
insts.extend(Inst::load_constant64(tmp, off as u64, |_| tmp));
MemArg::reg_plus_reg(base, tmp.to_reg(), mem.get_flags())
}
}