[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 22:51:14 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/3] [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 b269dc7a715ea0a8e63ea806fd67d235e4a39433 Mon Sep 17 00:00:00 2001
From: gitoleg <forown at yandex.ru>
Date: Mon, 25 Dec 2023 17:49:52 +0300
Subject: [PATCH 2/3] adds assert to the direct call builder
---
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 2fb82aeaa2bda7..67e5d0f344200b 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -908,9 +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();
+ assert(callee && "no callee in direct call builder");
build(builder, state, results,
- TypeAttr::get(getLLVMFuncType(builder.getContext(), results, fargs)),
+ TypeAttr::get(getLLVMFuncType(builder.getContext(), results, args)),
callee, args, /*fastmathFlags=*/nullptr, /*branch_weights=*/nullptr,
/*CConv=*/nullptr,
/*access_groups=*/nullptr, /*alias_scopes=*/nullptr,
>From 18056594a18404c737948326f22983dd52bd7930 Mon Sep 17 00:00:00 2001
From: gitoleg <forown at yandex.ru>
Date: Tue, 26 Dec 2023 09:50:26 +0300
Subject: [PATCH 3/3] edited the assert message
---
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 67e5d0f344200b..64388a9a01812a 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) {
- assert(callee && "no callee in direct call builder");
+ 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,
More information about the Mlir-commits
mailing list