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

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 3 01:55:01 PDT 2023


shchenz added a subscriber: joerg.
shchenz added a comment.

add @joerg who helped to add PIC mode jump table in https://reviews.llvm.org/D26336



================
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
 ;
----------------
tingwang wrote:
> 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}
XLC don't use `add`, but the contents in the jump table are not block addresses. They are the sum of the function address and the offsets of the branch targets in that function.


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