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

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 15 06:53:22 PST 2026


================
@@ -1923,6 +1924,19 @@ class IRBuilderBase {
     return Insert(new AtomicRMWInst(Op, Ptr, Val, *Align, Ordering, SSID));
   }
 
+  StructuredGEPInst *CreateStructuredGEP(Type *BaseType, Value *PtrBase,
+                                         ArrayRef<llvm::Value *> Indices,
+                                         const Twine &Name = "") {
+    SmallVector<llvm::Value *, 4> Args;
+    Args.push_back(llvm::PoisonValue::get(BaseType));
+    Args.push_back(PtrBase);
+    llvm::append_range(Args, Indices);
+
+    return cast<StructuredGEPInst>(
+        CreateIntrinsic(Intrinsic::structured_gep,
+                        {PtrBase->getType(), BaseType}, Args, {}, Name));
----------------
Keenuts wrote:

Thanks, made the change, not using ElementType attr (which is way cleaner)

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


More information about the cfe-commits mailing list