[llvm] [SPIR-V] Fixup storage class for global private (PR #116636)
Vyacheslav Levytskyy via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 03:00:29 PST 2024
Nathan =?utf-8?q?Gauër?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/116636 at github.com>
================
@@ -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;
----------------
VyacheslavLevytskyy wrote:
Actually, there is even better and simpler approach, similar to what @MrSidims asked about adjusting a frontend. We can do the substitution much much earlier, *before* IR Translation, to be sure that this is not intertwined with type inference and duplicates tracker.
https://github.com/llvm/llvm-project/pull/116636
More information about the llvm-commits
mailing list