[clang] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 13:10:54 PDT 2024


================
@@ -3581,8 +3582,10 @@ ConstantAddress CodeGenModule::GetAddrOfTemplateParamObject(
       isExternallyVisible(TPO->getLinkageAndVisibility().getLinkage())
           ? llvm::GlobalValue::LinkOnceODRLinkage
           : llvm::GlobalValue::InternalLinkage;
-  auto *GV = new llvm::GlobalVariable(getModule(), Init->getType(),
-                                      /*isConstant=*/true, Linkage, Init, Name);
+  auto *GV = new llvm::GlobalVariable(
+      getModule(), Init->getType(),
+      /*isConstant=*/true, Linkage, Init, Name, nullptr,
+      llvm::GlobalValue::NotThreadLocal, GlobalsInt8PtrTy->getAddressSpace());
----------------
efriedma-quic wrote:

This doesn't do anything unless the datalayout is broken: globals already go into getDefaultGlobalsAddressSpace() by default

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


More information about the cfe-commits mailing list