Skip to content

Commit 8cf6bcf

Browse files
authored
[mlir][llvm] Add assert in CallOp builder (#76240)
This commit adds an assert in one of the CallOp builders to ensure it is not use to create an indirect call. Otherwise, the callee type would include the callee pointer type which is handed in as first argument.
1 parent 1150e8e commit 8cf6bcf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
908908

909909
void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
910910
FlatSymbolRefAttr callee, ValueRange args) {
911+
assert(callee && "expected non-null callee in direct call builder");
911912
build(builder, state, results,
912913
TypeAttr::get(getLLVMFuncType(builder.getContext(), results, args)),
913914
callee, args, /*fastmathFlags=*/nullptr, /*branch_weights=*/nullptr,

0 commit comments

Comments
 (0)