[all-commits] [llvm/llvm-project] 8cbfc0: [X86] Respect blockaddress offsets when performing...

Maurice Heumann via All-commits all-commits at lists.llvm.org
Thu Nov 9 16:12:32 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8cbfc0b29d7e6c3b1066ef1f2ccba10c8980bdcf
      https://github.com/llvm/llvm-project/commit/8cbfc0b29d7e6c3b1066ef1f2ccba10c8980bdcf
  Author: Maurice Heumann <MauriceHeumann at gmail.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M llvm/lib/Target/X86/X86FixupLEAs.cpp
    A llvm/test/CodeGen/X86/lea-fixup-blockaddress.mir

  Log Message:
  -----------
  [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




More information about the All-commits mailing list