[llvm] GlobalOpt: Use the correct address space when creating a "*.init" global. (PR #118562)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 16:04:50 PST 2024


================
@@ -950,7 +950,8 @@ OptimizeGlobalAddressOfAllocation(GlobalVariable *GV, CallInst *CI,
     new GlobalVariable(Type::getInt1Ty(GV->getContext()), false,
                        GlobalValue::InternalLinkage,
                        ConstantInt::getFalse(GV->getContext()),
-                       GV->getName()+".init", GV->getThreadLocalMode());
+                       GV->getName()+".init", GV->getThreadLocalMode(),
+                       GV->getType()->getAddressSpace());
----------------
arsenm wrote:

```suggestion
                       GV->getAddressSpace());
```

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


More information about the llvm-commits mailing list