[Mlir-commits] [mlir] e08e5e2 - [mlir][transforms] Use `isExternal` instead of `isDeclaration` for `FunctionOpInterface` (#116573)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Dec 3 19:14:41 PST 2024
Author: Longsheng Mou
Date: 2024-12-04T11:14:37+08:00
New Revision: e08e5e2c426467342dbe79fbf3ea9723c17a07d1
URL: https://github.com/llvm/llvm-project/commit/e08e5e2c426467342dbe79fbf3ea9723c17a07d1
DIFF: https://github.com/llvm/llvm-project/commit/e08e5e2c426467342dbe79fbf3ea9723c17a07d1.diff
LOG: [mlir][transforms] Use `isExternal` instead of `isDeclaration` for `FunctionOpInterface` (#116573)
This PR fixes a bug in `RemoveDeadValues` where the
`FunctionOpInterface` does not have the `isDeclaration` method. As a
result, we should use the `isExternal` method instead. Fixes #116347.
Added:
Modified:
mlir/lib/Transforms/RemoveDeadValues.cpp
mlir/test/Transforms/remove-dead-values.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/RemoveDeadValues.cpp b/mlir/lib/Transforms/RemoveDeadValues.cpp
index 0aa9dcb36681b3..dbce4a540dcfb1 100644
--- a/mlir/lib/Transforms/RemoveDeadValues.cpp
+++ b/mlir/lib/Transforms/RemoveDeadValues.cpp
@@ -191,10 +191,10 @@ static void cleanSimpleOp(Operation *op, RunLivenessAnalysis &la) {
/// non-live across all callers),
/// (5) Dropping the uses of these return values from its callers, AND
/// (6) Erasing these return values
-/// iff it is not public or declaration.
+/// iff it is not public or external.
static void cleanFuncOp(FunctionOpInterface funcOp, Operation *module,
RunLivenessAnalysis &la) {
- if (funcOp.isPublic() || funcOp.isDeclaration())
+ if (funcOp.isPublic() || funcOp.isExternal())
return;
// Get the list of unnecessary (non-live) arguments in `nonLiveArgs`.
diff --git a/mlir/test/Transforms/remove-dead-values.mlir b/mlir/test/Transforms/remove-dead-values.mlir
index 826f6159a36b67..538755291e81a6 100644
--- a/mlir/test/Transforms/remove-dead-values.mlir
+++ b/mlir/test/Transforms/remove-dead-values.mlir
@@ -377,3 +377,8 @@ func.func @kernel(%arg0: memref<18xf32>) {
// CHECK: func.func private @no_block_func_declaration()
func.func private @no_block_func_declaration() -> ()
+
+// -----
+
+// CHECK: llvm.func @no_block_external_func()
+llvm.func @no_block_external_func() attributes {sym_visibility = "private"}
More information about the Mlir-commits
mailing list