[PATCH] D140975: Support critical edge splitting for jump tables

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 15:40:51 PDT 2023


MatzeB added inline comments.


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:3237
+  //   %0 = LEA64r $rip, 1, $noreg, %jump-table.X
+  //   %1 = ADD64rr %X, %0
+  //   JMP64r %1
----------------
craig.topper wrote:
> The non-PIC code has the %X scaled by 8, but the PIC code doesn't show a scale. What accounts for the difference?
The full code pattern looks something like with the scaling happening in the `MOVSX64rm32`. I just didn't explicitely mention it as we don't bother looking at that part of the pattern because we only need to find the `%jump-table` operand. It looks something like this:

```
  %XX = ...
  %0:gr64 = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg
  %1:gr64 = MOVSX64rm32 %0:gr64, 4, %XX:gr64_nosp, 0, $noreg :: (load (s32) from jump-table)
  %2:gr64 = ADD64rr %1:gr64(tied-def 0), %0:gr64, implicit-def dead $eflags
```

I will update the comment here to reduce the confusion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140975/new/

https://reviews.llvm.org/D140975



More information about the llvm-commits mailing list