[llvm] [SPIR-V] initial support for @llvm.structured.gep (PR #178668)

Steven Perron via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 07:15:35 PST 2026


================
@@ -1619,6 +1630,26 @@ static bool isFirstIndexZero(const GetElementPtrInst *GEP) {
   return false;
 }
 
+Instruction *SPIRVEmitIntrinsics::visitIntrinsicInst(IntrinsicInst &I) {
+  auto *SGEP = dyn_cast<StructuredGEPInst>(&I);
+  if (!SGEP)
+    return &I;
+
+  IRBuilder<> B(I.getParent());
+  B.SetInsertPoint(&I);
+  SmallVector<Type *, 2> Types = {I.getType(), I.getOperand(0)->getType()};
+  SmallVector<Value *, 4> Args;
+  Args.push_back(/* inBounds= */ B.getInt1(true));
+  Args.push_back(I.getOperand(0));
+  Args.push_back(/* zero index */ B.getInt32(0));
+  for (unsigned I = 0; I < SGEP->getNumIndices(); ++I)
----------------
s-perron wrote:

`I` is the name of the IntrinsicInst as well. Could you give a different name to one of them?

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


More information about the llvm-commits mailing list