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

Amy Kwan via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 08:22:54 PDT 2024


================
@@ -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 &Model,
+                                         SelectionDAG &DAG,
+                                         const TargetMachine &TM) {
+  // 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<PPCFunctionInfo>();
+  if (!FuncInfo->isAIXFuncTLSModelOptInitDone()) {
+    SmallPtrSet<const GlobalValue *, 8> 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


More information about the llvm-commits mailing list