Files
clang-p2996/llvm/lib/Target/X86/X86FixupLEAs.cpp
Maurice Heumann 8cbfc0b29d [X86] Respect blockaddress offsets when performing X86 LEA fixups (#71641)
The X86FixupLEAs pass drops blockaddress offsets, when splitting up slow
3-ops LEAs, as can be seen in this example:

https://godbolt.org/z/bEsc3Poje

Before running the pass, the first instruction in bb.0 is a LEA with
ebp, ebx and a blockaddress.
After the transformation, the blockaddress is missing.

The reason this happens is because the 3-ops LEA is being splitup into a
2-ops LEA + an add instruction.
However, as hasLEAOffset does not take blockaddresses into
consideration, the add is not emitted and thus leading to the offset
being dropped.

Taking blockaddresses into consideration fixes this issue and results in
the add instruction being emitted.

This fixes #71667
2023-11-10 08:12:18 +08:00

32 KiB