[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)
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 17:38:28 PDT 2023
hubert.reinterpretcast added inline comments.
================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1584
+ // Handle small-local-exec-tls accesses only for the local-exec TLS model,
+ // which is represented by the MO_TREL_FLAG target flag.
+ if (!(MO.getTargetFlags() & PPCII::MO_TPREL_FLAG))
----------------
Typo?
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:155
+// size of 32KB or under.
+static uint64_t AIXTLSUpperDisplacement = 32760;
+
----------------
Should be `constexpr`.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:3356
+ // the offset from the TLS base is encoded as an immediate operand.
+ // This is available on 64-bit mode only.
+ //
----------------
The last sentence is redundant with statements made on the 32-bit path.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:3364
+ uint64_t GVTypeSize =
+ GV->getParent()->getDataLayout().getTypeAllocSize(GV->getValueType());
+ if (HasAIXSmallLocalExecTLS &&
----------------
ICE/assert:
```
clang: /terrannew/hstong/.Lpcoral03/llvmbld/dev/llvm-project/llvm/include/llvm/IR/DataLayout.h:669: TypeSize llvm::DataLayout::getTypeSizeInBits(Type *) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.
```
with
```
clang --target=powerpc64-ibm-aix -c -o /dev/null -xc++ -<<<$'extern __thread struct X x [[gnu::tls_model("local-exec")]];\nvoid *f() { return &x; }'
```
A similar case with an array of unknown bound does not assert; however, it does generate the small TLS access pattern despite the size being unknown (and potentially huge).
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:3378-3379
+
+ // The faster access sequence for local-exec controlled by
+ // -maix-small-local-exec-tls is not available on 32-bit mode.
+ if (HasAIXSmallLocalExecTLS)
----------------
The comment should be clear that there is a 32-bit version that is merely omitted by the implementation here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155600/new/
https://reviews.llvm.org/D155600
More information about the llvm-commits
mailing list