Skip to content

Commit e08e5e2

Browse files
authored
[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.
1 parent 3dc9755 commit e08e5e2

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

mlir/lib/Transforms/RemoveDeadValues.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ static void cleanSimpleOp(Operation *op, RunLivenessAnalysis &la) {
191191
/// non-live across all callers),
192192
/// (5) Dropping the uses of these return values from its callers, AND
193193
/// (6) Erasing these return values
194-
/// iff it is not public or declaration.
194+
/// iff it is not public or external.
195195
static void cleanFuncOp(FunctionOpInterface funcOp, Operation *module,
196196
RunLivenessAnalysis &la) {
197-
if (funcOp.isPublic() || funcOp.isDeclaration())
197+
if (funcOp.isPublic() || funcOp.isExternal())
198198
return;
199199

200200
// Get the list of unnecessary (non-live) arguments in `nonLiveArgs`.

mlir/test/Transforms/remove-dead-values.mlir

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,3 +377,8 @@ func.func @kernel(%arg0: memref<18xf32>) {
377377

378378
// CHECK: func.func private @no_block_func_declaration()
379379
func.func private @no_block_func_declaration() -> ()
380+
381+
// -----
382+
383+
// CHECK: llvm.func @no_block_external_func()
384+
llvm.func @no_block_external_func() attributes {sym_visibility = "private"}

0 commit comments

Comments
 (0)