[llvm] [SPIR-V] Fixup storage class for global private (PR #116636)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 09:18:41 PST 2024


================
@@ -3264,9 +3264,15 @@ bool SPIRVInstructionSelector::selectGlobalValue(
     PointerBaseType = GR.getOrCreateSPIRVType(
         GVType, MIRBuilder, SPIRV::AccessQualifier::ReadWrite, false);
   }
-  SPIRVType *ResType = GR.getOrCreateSPIRVPointerType(
-      PointerBaseType, I, TII,
-      addressSpaceToStorageClass(GV->getAddressSpace(), STI));
+
+  const unsigned AddrSpace = GV->getAddressSpace();
+  SPIRV::StorageClass::StorageClass StorageClass =
+      addressSpaceToStorageClass(AddrSpace, STI);
+  if (StorageClass == SPIRV::StorageClass::Function)
+    StorageClass = SPIRV::StorageClass::Private;
----------------
Keenuts wrote:

This is indeed possible (initial PR added a `vulkan_private` address space).
But if the proposed RFC to set AS0=generic doesn't come true, I'd tend to believe AS0+global should end up in the private class, like AS0+local ends up in the Function class. 

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


More information about the llvm-commits mailing list