[clang] [HLSL] Don't use CreateRuntimeFunction for intrinsics (PR #145334)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 23 07:20:28 PDT 2025
================
@@ -676,35 +676,23 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
case Builtin::BI__builtin_hlsl_wave_active_sum: {
// Due to the use of variadic arguments, explicitly retreive argument
Value *OpExpr = EmitScalarExpr(E->getArg(0));
- llvm::FunctionType *FT = llvm::FunctionType::get(
- OpExpr->getType(), ArrayRef{OpExpr->getType()}, false);
Intrinsic::ID IID = getWaveActiveSumIntrinsic(
getTarget().getTriple().getArch(), CGM.getHLSLRuntime(),
E->getArg(0)->getType());
- // Get overloaded name
- std::string Name =
- Intrinsic::getName(IID, ArrayRef{OpExpr->getType()}, &CGM.getModule());
- return EmitRuntimeCall(CGM.CreateRuntimeFunction(FT, Name, {},
- /*Local=*/false,
- /*AssumeConvergent=*/true),
+ return EmitRuntimeCall(Intrinsic::getOrInsertDeclaration(
----------------
farzonl wrote:
This is correct. @Keenuts did `EmitRuntimeCall(Intrinsic::getOrInsertDeclaration(` in https://github.com/llvm/llvm-project/pull/143127/files Thats what we expect to use for these convergence intrinsics.
Looks like this was just an accident introduced in this pr: https://github.com/llvm/llvm-project/pull/118580/files#diff-202c36399fe94363f22692e534129341972137a24721c385b1f1f05fb239dd79R19523 and then the patttern may have been copied by others.
https://github.com/llvm/llvm-project/pull/145334
More information about the cfe-commits
mailing list