aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgitoleg <forown@yandex.ru>2023-12-27 19:08:35 +0300
committerGitHub <noreply@github.com>2023-12-27 17:08:35 +0100
commit8cf6bcf5a30673dd8a234ae3ef4ab4c1e63786b1 (patch)
treeb1ed83021573e461d46a4f5a9570c5e284cd2c39
parent1150e8ef7765f43a730575bd224eda18e916ac1e (diff)
downloadllvm-8cf6bcf5a30673dd8a234ae3ef4ab4c1e63786b1.zip
llvm-8cf6bcf5a30673dd8a234ae3ef4ab4c1e63786b1.tar.gz
llvm-8cf6bcf5a30673dd8a234ae3ef4ab4c1e63786b1.tar.bz2
[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.
-rw-r--r--mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 458bf83..64388a9 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -908,6 +908,7 @@ void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
FlatSymbolRefAttr callee, ValueRange args) {
+ assert(callee && "expected non-null callee in direct call builder");
build(builder, state, results,
TypeAttr::get(getLLVMFuncType(builder.getContext(), results, args)),
callee, args, /*fastmathFlags=*/nullptr, /*branch_weights=*/nullptr,