[Mlir-commits] [mlir] Allow SymbolUserOpInterface operators to be used in RemoveDeadValues Pass (PR #117405)
M. Zeeshan Siddiqui
llvmlistbot at llvm.org
Sat Nov 23 09:49:15 PST 2024
================
@@ -577,10 +577,8 @@ void RemoveDeadValues::runOnOperation() {
WalkResult acceptableIR = module->walk([&](Operation *op) {
if (op == module)
return WalkResult::advance();
- if (isa<BranchOpInterface>(op) ||
- (isa<SymbolUserOpInterface>(op) && !isa<CallOpInterface>(op))) {
- op->emitError() << "cannot optimize an IR with "
- "non-call symbol user ops or branch ops\n";
+ if (isa<BranchOpInterface>(op)) {
----------------
codemzs wrote:
@parsifal-47 If I change the test to have memory effects (i.e `memref.store`) in the blocks then the test passes, i.e:
PASS:
```
func.func @test_2_RegionBranchOpInterface_type_1.b(%arg0: memref<i32>, %arg1: memref<i32>, %arg2: i1) {
%c0_i32 = arith.constant 0 : i32
cf.cond_br %arg2, ^bb1(%c0_i32 : i32), ^bb2(%c0_i32 : i32) {tag = "br"}
^bb1(%0 : i32):
memref.store %0, %arg0[] : memref<i32>
cf.br ^bb3
^bb2(%1 : i32):
memref.store %1, %arg1[] : memref<i32>
cf.br ^bb3
^bb3:
return
}
```
FAIL:
```
func.func @dont_touch_unacceptable_ir_has_cleanable_simple_op_with_branch_op(%arg0: i1) {
%non_live = arith.constant 0 : i32
cf.cond_br %arg0, ^bb1(%non_live : i32), ^bb2(%non_live : i32) {tag = "br"}
^bb1(%non_live_0 : i32):
cf.br ^bb3
^bb2(%non_live_1 : i32):
cf.br ^bb3
^bb3:
return
}
```
https://github.com/llvm/llvm-project/pull/117405
More information about the Mlir-commits
mailing list