[clang] [llvm] [clang][OpenMP][SPIR-V] Fix addrspace of globals and global constants (PR #134399)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 11:46:58 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())
----------------
AlexVlx wrote:

This feels like a spot where we are missing something in Clang - the string should've at least been AS1; some time ago I had a pop at fixing a bunch of places in CodeGen where we just used 0 / unqual rather than getting the GlobalVar AS or the Constant AS, but issues clearly remain - I think we should try to address this in Clang. Are you seeing the above with `spirv64-unknown-unknown`?

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


More information about the cfe-commits mailing list