[clang] [llvm] [clang][OpenMP][SPIR-V] Fix addrspace of globals and global constants (PR #134399)
Nick Sarnie via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 7 12:36:12 PDT 2025
================
@@ -5384,6 +5384,11 @@ LangAS CodeGenModule::GetGlobalVarAddressSpace(const VarDecl *D) {
LangAS AS;
if (OpenMPRuntime->hasAllocateAttributeForGlobalVar(D, AS))
return AS;
+ if (LangOpts.OpenMPIsTargetDevice && getTriple().isSPIRV())
----------------
sarnex wrote:
BTW codegen already does the right thing because of [this](https://github.com/llvm/llvm-project/blob/10bef367a5643bc41d0172b02e080645c68f821a/clang/lib/CodeGen/CodeGenModule.cpp#L5394) code in GetGlobalConstantAddressSpace, and `CodeGenOpenCL/str_literals.cl` already locks it down, so the OpenCL part of my change is basically NFC.
https://github.com/llvm/llvm-project/pull/134399
More information about the cfe-commits
mailing list