[clang] [llvm] [IR] Add llvm.structured.gep instruction (PR #176145)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 03:23:32 PST 2026


Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>,
Nathan =?utf-8?q?Gau=C3=ABr?= <brioche at google.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/176145 at github.com>


================
@@ -1804,6 +1804,46 @@ class ConvergenceControlInst : public IntrinsicInst {
   CreateLoop(BasicBlock &BB, ConvergenceControlInst *Parent);
 };
 
+class StructuredGEPInst : public IntrinsicInst {
+public:
+  static bool classof(const IntrinsicInst *I) {
+    return I->getIntrinsicID() == Intrinsic::structured_gep;
+  }
+
+  static bool classof(const Value *V) {
+    return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
+  }
+
+  Type *getBaseType() const {
+    return getParamAttr(0, Attribute::ElementType).getValueAsType();
+  }
+
+  unsigned getIndicesCount() const { return getNumOperands() - 2; }
----------------
nikic wrote:

```suggestion
  unsigned getNumIndices() const { return getNumOperands() - 2; }
```
To match GEP APIs.

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


More information about the cfe-commits mailing list