[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-05-08 Thread Felix via cfe-commits

https://github.com/orcguru closed 
https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-26 Thread Amy Kwan via cfe-commits


@@ -3362,6 +3367,54 @@ SDValue PPCTargetLowering::LowerGlobalTLSAddress(SDValue 
Op,
   return LowerGlobalTLSAddressLinux(Op, DAG);
 }
 
+/// updateForAIXShLibTLSModelOpt - Helper to initialize TLS model opt settings,
+/// and then apply the update.
+static void updateForAIXShLibTLSModelOpt(TLSModel::Model ,
+ SelectionDAG ,
+ const TargetMachine ) {
+  // Initialize TLS model opt setting lazily:
+  // (1) Use initial-exec for single TLS var references within current 
function.
+  // (2) Use local-dynamic for multiple TLS var references within current
+  // function.
+  PPCFunctionInfo *FuncInfo =
+  DAG.getMachineFunction().getInfo();
+  if (!FuncInfo->isAIXFuncTLSModelOptInitDone()) {
+SmallPtrSet TLSGV;
+// Iterate over all instructions within current function, collect all TLS

amy-kwan wrote:

nit on comment:
```suggestion
// Iterate over all instructions within the current function and collect 
all TLS
```

https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-26 Thread Amy Kwan via cfe-commits

https://github.com/amy-kwan approved this pull request.

LGTM after all the updates. Thanks!

https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-26 Thread Amy Kwan via cfe-commits

https://github.com/amy-kwan edited 
https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-25 Thread Kai Luo via cfe-commits


@@ -80,6 +80,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   bool IsISA3_0 = false;
   bool IsISA3_1 = false;
   bool HasQuadwordAtomics = false;
+  bool HasAIXShLibTLSModelHeuristic = false;

bzEq wrote:

Code in `PPCTargetLowering::LowerGlobalTLSAddressAIX` like
```
Subtarget.hasAIXSmallLocalExecTLS()
```
which is generated in `PPCGenSubtargetInfo.inc`, whose value is initialized by 
feature string `aix-small-local-exec-tls` in LLVM IR rather than the variable 
defined in clang.

https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-25 Thread Kai Luo via cfe-commits


@@ -80,6 +80,7 @@ class LLVM_LIBRARY_VISIBILITY PPCTargetInfo : public 
TargetInfo {
   bool IsISA3_0 = false;
   bool IsISA3_1 = false;
   bool HasQuadwordAtomics = false;
+  bool HasAIXShLibTLSModelHeuristic = false;

bzEq wrote:

The variable defined here is only visible to clang and clang doesn't use this 
flag further. What backend sees is the feature string and set corresponding 
variables in backend accordingly.

https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Tune AIX shared library TLS model at function level (PR #84132)

2024-04-22 Thread Felix via cfe-commits

https://github.com/orcguru edited 
https://github.com/llvm/llvm-project/pull/84132
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits