[llvm] [HLSL][SPIRV] Legalize reinterpretation ptrcasts for byte-addressable buffers (PR #212999)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 05:08:54 PDT 2026


================
@@ -222,15 +222,59 @@ class SPIRVLegalizePointerCastImpl {
     return std::make_pair(GEP, CurrentTy);
   }
 
+  // Returns the pointer operand of a load/store that uses a ptrcast.
+  static Value *getCastedPointerOperand(Instruction *MemI) {
+    if (auto *LI = dyn_cast<LoadInst>(MemI))
+      return LI->getPointerOperand();
+    if (auto *SI = dyn_cast<StoreInst>(MemI))
+      return SI->getPointerOperand();
+    if (auto *II = dyn_cast<IntrinsicInst>(MemI))
+      if (II->getIntrinsicID() == Intrinsic::spv_store)
----------------
farzonl wrote:

A symmetry question i have is if we are looking at loads and stores for llvm instructions why are we just looking at spv_store and not spv_load?

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


More information about the llvm-commits mailing list