Files
clang-p2996/mlir/test/Transforms/test-operation-folder-commutative.mlir
Matthias Springer 253afd03f1 [mlir][Interfaces] Symbols are not trivially dead
The greedy pattern rewrite driver removes ops that are "trivially dead". This could include symbols that are still referenced by other ops. Dead symbols should be removed with the `-symbol-dce` pass instead.

This bug was not triggered for `func::FuncOp`, because ops are not considered "trivally dead" if they do not implement the `MemoryEffectOpInterface`, indicating that the op may or may not have side effects. It is, however, triggered for `transform::NamedSequenceOp`, which implements that interface because it is required for all transform dialect ops.

Differential Revision: https://reviews.llvm.org/D152994
2023-06-15 11:21:41 +02:00

12 lines
456 B
MLIR

// RUN: mlir-opt --pass-pipeline="builtin.module(test-patterns)" %s | FileCheck %s
// CHECK-LABEL: func @test_reorder_constants_and_match
func.func @test_reorder_constants_and_match(%arg0 : i32) -> (i32) {
// CHECK: %[[CST:.+]] = arith.constant 43
%cst = arith.constant 43 : i32
// CHECK: return %[[CST]]
%y = "test.op_commutative2"(%cst, %arg0) : (i32, i32) -> i32
%x = "test.op_commutative2"(%y, %arg0) : (i32, i32) -> i32
return %x : i32
}