[Mlir-commits] [mlir] [mlir][llvm] Fixes CallOp builder for the case of indirect call (PR #76240)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Dec 25 06:47:12 PST 2023
https://github.com/gitoleg updated https://github.com/llvm/llvm-project/pull/76240
>From 30cffd17a6f2c48c20cce89c0591344da4ec86d6 Mon Sep 17 00:00:00 2001
From: gitoleg <forown at yandex.ru>
Date: Fri, 22 Dec 2023 16:40:25 +0300
Subject: [PATCH 1/2] [mlir][llvm] Fixes CallOp builder for the case of
indirect call
---
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 458bf83eac17f8..2fb82aeaa2bda7 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -908,8 +908,9 @@ void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
FlatSymbolRefAttr callee, ValueRange args) {
+ auto fargs = callee ? args : args.drop_front();
build(builder, state, results,
- TypeAttr::get(getLLVMFuncType(builder.getContext(), results, args)),
+ TypeAttr::get(getLLVMFuncType(builder.getContext(), results, fargs)),
callee, args, /*fastmathFlags=*/nullptr, /*branch_weights=*/nullptr,
/*CConv=*/nullptr,
/*access_groups=*/nullptr, /*alias_scopes=*/nullptr,
>From ca30c549a27bf1fc4d4dc55059cb58be10c2db3e Mon Sep 17 00:00:00 2001
From: gitoleg <forown at yandex.ru>
Date: Mon, 25 Dec 2023 17:42:52 +0300
Subject: [PATCH 2/2] adds assert to the direct call builder
---
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 2fb82aeaa2bda7..5963d6a2c4dfc4 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -908,7 +908,7 @@ void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
void CallOp::build(OpBuilder &builder, OperationState &state, TypeRange results,
FlatSymbolRefAttr callee, ValueRange args) {
- auto fargs = callee ? args : args.drop_front();
+ assert(callee && "no callee in direct call builder");
build(builder, state, results,
TypeAttr::get(getLLVMFuncType(builder.getContext(), results, fargs)),
callee, args, /*fastmathFlags=*/nullptr, /*branch_weights=*/nullptr,
More information about the Mlir-commits
mailing list