File tree 2 files changed +10
-7
lines changed 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -576,6 +576,8 @@ void RemoveDeadValues::runOnOperation() {
576
576
// all symbol ops present in the IR are function-like, and all symbol user ops
577
577
// present in the IR are call-like.
578
578
WalkResult acceptableIR = module->walk ([&](Operation *op) {
579
+ if (op == module)
580
+ return WalkResult::advance ();
579
581
if (isa<BranchOpInterface>(op) ||
580
582
(isa<SymbolOpInterface>(op) && !isa<FunctionOpInterface>(op)) ||
581
583
(isa<SymbolUserOpInterface>(op) && !isa<CallOpInterface>(op))) {
Original file line number Diff line number Diff line change 1
1
// RUN: mlir-opt %s -remove-dead-values -split-input-file -verify-diagnostics | FileCheck %s
2
2
3
- // The IR remains untouched because of the presence of a non-function-like
4
- // symbol op (module @dont_touch_unacceptable_ir).
3
+ // -----
4
+
5
+ // Dead values are removed from the IR even if the module has a name
5
6
//
6
- // expected-error @+1 {{cannot optimize an IR with non-function symbol ops, non-call symbol user ops or branch ops}}
7
- module @dont_touch_unacceptable_ir {
8
- func.func @has_cleanable_simple_op ( %arg0 : i32 ) {
9
- %non_live = arith.addi %arg0 , %arg0 : i32
10
- return
7
+ module @named_module_acceptable {
8
+ func.func @main ( %arg0: tensor < 10 x f32 >) -> tensor < 10 x f32 > {
9
+ %0 = tensor.empty () : tensor < 10 x bf16 >
10
+ // CHECK-NOT: %[[C:.*]] = tensor.empty[[C:.*]]
11
+ return %arg0 : tensor < 10 x f32 >
11
12
}
12
13
}
13
14
You can’t perform that action at this time.
0 commit comments