[llvm] [SPIR-V] Preserve pointer-to-pointer element type for T*& parameters (PR #203113)

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 12 01:53:17 PDT 2026


================
@@ -546,6 +546,17 @@ static bool IsKernelArgInt8(Function *F, StoreInst *SI) {
          isa<Argument>(SI->getValueOperand());
 }
 
+// A pointer-typed local holds a pointer, so its deduced pointee must stay a
+// pointer.
+static bool tracesToPointerAlloca(Value *V) {
+  using namespace PatternMatch;
+  V = V->stripPointerCasts();
+  if (auto *AI = dyn_cast<AllocaInst>(V))
+    return isUntypedPointerTy(AI->getAllocatedType());
+  return match(V, m_Intrinsic<Intrinsic::spv_alloca>()) ||
+         match(V, m_Intrinsic<Intrinsic::spv_alloca_array>());
----------------
jmmartinez wrote:

```suggestion
  return match(V, m_AnyIntrinsic<Intrinsic::spv_alloca, Intrinsic::spv_alloca_array>());
```

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


More information about the llvm-commits mailing list