[clang] [llvm] [DirectX] Add resource name argument to llvm.dx.handlefrom[implicit]binding intrinsics (PR #139991)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 11:40:06 PDT 2025


================
@@ -299,9 +299,20 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
     // (llvm/llvm-project#135452)
     Value *NonUniform =
         llvm::ConstantInt::get(llvm::Type::getInt1Ty(getLLVMContext()), false);
-    return Builder.CreateIntrinsic(
-        HandleTy, CGM.getHLSLRuntime().getCreateHandleFromBindingIntrinsic(),
-        ArrayRef<Value *>{SpaceOp, RegisterOp, RangeOp, IndexOp, NonUniform});
+
+    Intrinsic::ID IID =
+        CGM.getHLSLRuntime().getCreateHandleFromBindingIntrinsic();
+    // SPIR-V intrinsic does not have include the resource name
+    if (IID == Intrinsic::spv_resource_handlefrombinding)
----------------
bogner wrote:

Can we do this more generically? Either by checking the argument list of the intrinsic function or by specializing getCreateHandleFromBindingIntrinsic to report if it has a name in the signature?

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


More information about the cfe-commits mailing list