[PATCH] D155600: [AIX][TLS] Produce a faster local-exec access sequence with -maix-small-local-exec-tls (And optimize when load/store offsets are 0)

Amy Kwan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 07:51:33 PDT 2023


amyk created this revision.
amyk added reviewers: PowerPC, nemanjai, stefanp, kamaub, hubert.reinterpretcast.
amyk added projects: LLVM, PowerPC.
Herald added subscribers: kbarton, hiraditya.
Herald added a project: All.
amyk requested review of this revision.
Herald added a subscriber: llvm-commits.

This patch utilizes the `-maix-small-local-exec-tls` option added in D155544 <https://reviews.llvm.org/D155544> to produce
a faster access sequence for the local-exec TLS model, where loading from the TOC can
be avoided. Instead, an `addi`/`la` with a displacement followed by a load/store 
directly off of r13 (the thread pointer) is produced.

This patch also optimizes this sequence a bit more where we can remove the `addi`/`la`
when the load/store offset is 0.
A follow up patch will be posted to account for when the load/store offset is non-zero,
and in these situations we simply produce the `addi`/`la` that precedes the load/store.

Furthermore, this access sequence is only performed for TLS variables that are less than
~32KB in size.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155600

Files:
  llvm/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp
  llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
  llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  llvm/lib/Target/PowerPC/PPCISelLowering.cpp
  llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-char.ll
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-double.ll
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-float.ll
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-int.ll
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-largeaccess.ll
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-longlong.ll
  llvm/test/CodeGen/PowerPC/aix-small-local-exec-tls-short.ll
  llvm/test/CodeGen/PowerPC/aix-tls-le-ldst-O0.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155600.541531.patch
Type: text/x-patch
Size: 76065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230718/9594afe8/attachment.bin>


More information about the llvm-commits mailing list