[llvm] [TargetLowering] Fix the problem of emulated-TLS implementation witho… (PR #101490)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 23:13:37 PDT 2024


================
@@ -10225,10 +10225,10 @@ SDValue TargetLowering::LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA,
 
   ArgListTy Args;
   ArgListEntry Entry;
-  std::string NameString = ("__emutls_v." + GA->getGlobal()->getName()).str();
-  Module *VariableModule = const_cast<Module*>(GA->getGlobal()->getParent());
+  const GlobalValue *GV = cast<GlobalValue>(GA->getGlobal()->stripPointerCastsAndAliases());
+  SmallString<32> NameString = StringRef("__emutls_v." + GV->getName().str());
----------------
arsenm wrote:

```suggestion
  SmallString<32> NameString("__emutls_v.");
  NameString += GV->getName();

```

https://github.com/llvm/llvm-project/pull/101490


More information about the llvm-commits mailing list