[clang] [llvm] [HLSL][SPIRV] Add IntrConvergent to convergent intrinsics (PR #211256)

Tim Corringham via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 28 02:09:10 PDT 2026


================
@@ -533,6 +533,19 @@ static Value *emitHlslClamp(CodeGenFunction &CGF, const CallExpr *E,
   return Clamp;
 }
 
+static CallInst *emitConvergentResourceIntrinsicCall(CodeGenFunction &CGF,
+                                                     llvm::Type *RetTy,
+                                                     Intrinsic::ID ID,
+                                                     ArrayRef<Value *> Args) {
+  SmallVector<llvm::Type *> ArgTys;
+  ArgTys.reserve(Args.size());
+  for (Value *Arg : Args)
+    ArgTys.push_back(Arg->getType());
+  Function *IntrFn = Intrinsic::getOrInsertDeclaration(&CGF.CGM.getModule(), ID,
+                                                       RetTy, ArgTys);
+  return CGF.EmitRuntimeCall(IntrFn, Args);
----------------
tcorringham wrote:

I started to refactor the emitRescourceIntrinsic() calls as suggested, but there are some differences across some intrinsics (runtimeCC etc.) which would require more arguments to be added. The result wasn't obviously cleaner than the current code. I think this should be revisited as a separate cleanup exercise after some thought has gone into it. 

I have added the property to the DirectX intrinsics, and amended the asm rount-trip test accordingly.

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


More information about the cfe-commits mailing list