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

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 06:54:08 PST 2026


================
@@ -6878,6 +6878,41 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
           &Call);
     break;
   }
+  case Intrinsic::structured_gep: {
+    // Parser should refuse those 2 cases.
+    assert(Call.getNumOperands() >= 2);
----------------
Keenuts wrote:

zero-index case is valid (returns the pointer as-is with no change)
The 2 base arguments are:
 - ptr base
 - Intrinsic definition (at least looks like so when calling `Call.getOperand(LAST).dump()`

```
(lldb) p Call.dump()
  %ptr = call ptr (ptr, ...) @llvm.structured.gep.p0(ptr elementtype(%S) %src, i32 0, i32 0)
(lldb) p Call.getOperand(3)->dump()
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare ptr @llvm.structured.gep.p0(ptr %0, ...) 
```

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


More information about the cfe-commits mailing list