[llvm] [SPIRV] Expand RWBuffer load and store from HLSL (PR #122355)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 09:21:20 PST 2025


================
@@ -1018,6 +1024,25 @@ bool SPIRVInstructionSelector::selectLoad(Register ResVReg,
                                           MachineInstr &I) const {
   unsigned OpOffset = isa<GIntrinsic>(I) ? 1 : 0;
   Register Ptr = I.getOperand(1 + OpOffset).getReg();
+
+  auto *PtrDef = getVRegDef(*MRI, Ptr);
+  auto *IntPtrDef = dyn_cast<GIntrinsic>(PtrDef);
+  if (IntPtrDef &&
+      IntPtrDef->getIntrinsicID() == Intrinsic::spv_resource_getpointer) {
----------------
Keenuts wrote:

So if the codegen/opti doesn't keep the `getpointer`/`load` duo, but adds another temporary in between, this will fail silently and generate an OpLoad no?
Could reg2mem be an issue?

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


More information about the llvm-commits mailing list