Skip to content

Commit 75a6efb

Browse files
committed
Allowing IRs with global constants to get dead values removed
1 parent be5dad0 commit 75a6efb

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

mlir/lib/Transforms/RemoveDeadValues.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ void RemoveDeadValues::runOnOperation() {
579579
if (op == module)
580580
return WalkResult::advance();
581581
if (isa<BranchOpInterface>(op) ||
582-
(isa<SymbolOpInterface>(op) && !isa<FunctionOpInterface>(op)) ||
583582
(isa<SymbolUserOpInterface>(op) && !isa<CallOpInterface>(op))) {
584583
op->emitError() << "cannot optimize an IR with non-function symbol ops, "
585584
"non-call symbol user ops or branch ops\n";

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: mlir-opt %s -remove-dead-values -split-input-file -verify-diagnostics | FileCheck %s
22

3-
// The IR remains untouched because of the presence of a non-function-like
4-
// symbol op inside the module (const @__dont_touch_unacceptable_ir).
3+
// The IR is updated regardless of memref.global private constant
54
//
65
module {
7-
// expected-error @+1 {{cannot optimize an IR with non-function symbol ops, non-call symbol user ops or branch ops}}
86
memref.global "private" constant @__dont_touch_unacceptable_ir : memref<i32> = dense<0>
97
func.func @main(%arg0: i32) -> i32 {
8+
%0 = tensor.empty() : tensor<10xbf16>
9+
// CHECK-NOT: tensor.empty
1010
return %arg0 : i32
1111
}
1212
}

0 commit comments

Comments
 (0)