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

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 13 11:23:22 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) {
----------------
s-perron wrote:

You are write that if the optimizer commons the `getpointer` call, and more it to another basic block, then `reg2mem` could add a temp. Again, we will need `mem2reg`.

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


More information about the llvm-commits mailing list