Open blackgeorge-boom opened 1 year ago
The MIR for X86 that exhibits this issue is:
96B %2:gr32 = MOV32rm $rip, 1, $noreg, @nx0, $noreg :: (dereferenceable load 4 from @nx0)
112B %3:gr32 = MOV32rm $rip, 1, $noreg, @ny0, $noreg :: (dereferenceable load 4 from @ny0)
128B undef %20.sub_32bit:gr64 = COPY %2:gr32
144B undef %21.sub_32bit:gr64_nosp = COPY %3:gr32
160B %4:gr32 = LEA64_32r %20:gr64, 1, %21:gr64_nosp, 0, $noreg
This is converted from:
%2:gr32 = MOV32rm $rip, 1, $noreg, @nx0, $noreg :: (dereferenceable load 4 from @nx0)
%3:gr32 = MOV32rm $rip, 1, $noreg, @ny0, $noreg :: (dereferenceable load 4 from @ny0)
%4:gr32 = nsw ADD32rr %2:gr32(tied-def 0), %3:gr32, implicit-def dead $eflags
after the twoaddressinstruction
pass.
The problem here is that the ADD32rr
instruction is converted to a three address LEA64_32r
, which has 64-bit operands.
AArch64:
X86:
The value of
nx0
in the case of X86 is extended to 64 bits and then it is stored as an 8-byte value (instead of a 4-byte value in AArch64), which makes the stacks different.