[clang] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 11 09:49:34 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());
----------------
AlexVlx wrote:
At the same time, it's not terribly costly (except for lines of code), and, unfortunately, there might be quite a few "broken" datalayouts (NVPTX is in the same boat, as is DirectX). I'm not entirely convinced the breakage is not an intentional design choice for pseudo/meta/abstract targets (abusing nomenclature, apologies). I'd submit that this (the changes/CodeGen) is still in Clang, which would still fall under the "the FE/language has to deal with ASes having special properties, LLVM shouldn't care", and it is an artifact of composing AS aware languages (OCL/CUDA/HIP etc.) with said abstract targets.
https://github.com/llvm/llvm-project/pull/88182
More information about the cfe-commits
mailing list