mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
ZJIT: Remove no-op movs after register allocation
Previously `no_dead_mov_from_vreg` generated:
0x0: ldur x0, [x0]
0x4: mov x0, x0
0x8: ret
Because of phase ordering. Split couldn't recognize that the no-op mov
because at that point it sees a `VReg`.
This commit is contained in:
parent
495e3f642b
commit
3bbdcf0848
@ -1424,6 +1424,20 @@ mod tests {
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_dead_mov_from_vreg() {
|
||||
let (mut asm, mut cb) = setup_asm();
|
||||
|
||||
let ret_val = asm.load(Opnd::mem(64, C_RET_OPND, 0));
|
||||
asm.cret(ret_val);
|
||||
|
||||
asm.compile_with_num_regs(&mut cb, 1);
|
||||
assert_disasm!(cb, "000040f8c0035fd6", "
|
||||
0x0: ldur x0, [x0]
|
||||
0x4: ret
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_emit_add() {
|
||||
let (mut asm, mut cb) = setup_asm();
|
||||
|
||||
@ -1752,6 +1752,9 @@ impl Assembler
|
||||
asm.push_insn(Insn::PosMarker(end_marker));
|
||||
}
|
||||
}
|
||||
Insn::Mov { src, dest } | Insn::LoadInto { dest, opnd: src } if src == dest => {
|
||||
// Remove no-op move now that VReg are resolved to physical Reg
|
||||
}
|
||||
_ => asm.push_insn(insn),
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user