[PATCH] D154048: [PowerPC] fix jumptable encoding when ppc-use-absolute-jumptables is turned on

Ting Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 00:24:53 PDT 2023


tingwang added inline comments.


================
Comment at: llvm/test/CodeGen/PowerPC/absol-jump-table-enabled.ll:73
 ; CHECK-A-PIC-LE-LABEL:       .LJTI0_0:
-; CHECK-A-PIC-LE:             .long   .LBB0_6-.LJTI0_0
+; CHECK-A-PIC-LE:             .quad   .LBB0_6
 ;
----------------
shchenz wrote:
> This change seems problematic to me. PIC is a functionality option while -ppc-use-absolute-jumptables=true is an optimization option (save the add instruction?), so if -ppc-use-absolute-jumptables=true and --relocation-model=pic are both true, we should use relative jump table which matches PIC requirement.
I don't take relative jump table as a necessary condition for PIC, for example check attached case_xlc.c when compiled by xlc using `-qpic=small` (which is equivalent to `-fpic` according to the migration guide) generates absolute address for jump table entries, use `ldx` to load the entry, and then jump to the address without `add`.

{F28114178}


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154048



More information about the llvm-commits mailing list