[llvm] [SPIRV][NFC] Refactor pointer creation in GlobalRegistery (PR #134429)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 05:48:12 PDT 2025


================
@@ -3366,18 +3370,20 @@ bool SPIRVInstructionSelector::selectImageWriteIntrinsic(
 }
 
 Register SPIRVInstructionSelector::buildPointerToResource(
-    const SPIRVType *ResType, SPIRV::StorageClass::StorageClass SC,
+    const SPIRVType *SpirvResType, SPIRV::StorageClass::StorageClass SC,
     uint32_t Set, uint32_t Binding, uint32_t ArraySize, Register IndexReg,
     bool IsNonUniform, MachineIRBuilder MIRBuilder) const {
+  Type *ResType = const_cast<Type *>(GR.getTypeForSPIRVType(SpirvResType));
   if (ArraySize == 1) {
-    SPIRVType *PtrType =
-        GR.getOrCreateSPIRVPointerType(ResType, MIRBuilder, SC);
+    SPIRVType *PtrType = GR.getOrCreateSPIRVPointerType(
+        const_cast<Type *>(ResType), MIRBuilder, SC);
----------------
Keenuts wrote:

useless const_cast?

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


More information about the llvm-commits mailing list