Skip to content

Commit 0843af1

Browse files
committed
[NFC][DXIL] Allow extra args to replaceFunctionWithOp
- allow passing down extra arguments when lowering a directx intrinsic to its dxil op code - this allows us to not create a custom intrinsic for the targeted intermediate intrinsic that it lowers to and does not require us to write a complete custom lowering
1 parent 6d13cc9 commit 0843af1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/lib/Target/DirectX/DXILOpLowering.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ class OpLowerer {
106106
}
107107

108108
[[nodiscard]]
109-
bool replaceFunctionWithOp(Function &F, dxil::OpCode DXILOp) {
109+
bool replaceFunctionWithOp(
110+
Function &F, dxil::OpCode DXILOp,
111+
std::optional<SmallVector<Value *>> ExtraArgs = std::nullopt) {
110112
bool IsVectorArgExpansion = isVectorArgExpansion(F);
111113
return replaceFunction(F, [&](CallInst *CI) -> Error {
112114
SmallVector<Value *> Args;
@@ -117,6 +119,11 @@ class OpLowerer {
117119
} else
118120
Args.append(CI->arg_begin(), CI->arg_end());
119121

122+
// Append any given alias arguments
123+
if (ExtraArgs) {
124+
Args.append(ExtraArgs->begin(), ExtraArgs->end());
125+
}
126+
120127
Expected<CallInst *> OpCall =
121128
OpBuilder.tryCreateOp(DXILOp, Args, CI->getName(), F.getReturnType());
122129
if (Error E = OpCall.takeError())

0 commit comments

Comments
 (0)