diff --git a/tests/filecheck/dialects/stencil/canonicalize.mlir b/tests/filecheck/dialects/stencil/canonicalize.mlir index ed92e65ab9..20d24820c3 100644 --- a/tests/filecheck/dialects/stencil/canonicalize.mlir +++ b/tests/filecheck/dialects/stencil/canonicalize.mlir @@ -39,8 +39,7 @@ func.func @unused_res(%f1 : !stencil.field<[0,64]xf64>, %f2 : !stencil.field<[0, // CHECK: func.func @unused_res(%f1 : !stencil.field<[0,64]xf64>, %f2 : !stencil.field<[0,64]xf64>, %of : !stencil.field<[0,64]xf64>) { // CHECK-NEXT: %t1 = stencil.load %f1 : !stencil.field<[0,64]xf64> -> !stencil.temp -// CHECK-NEXT: %t2 = stencil.load %f2 : !stencil.field<[0,64]xf64> -> !stencil.temp -// CHECK-NEXT: %o1 = stencil.apply(%one = %t1 : !stencil.temp, %two = %t2 : !stencil.temp) -> (!stencil.temp) { +// CHECK-NEXT: %o1 = stencil.apply(%one = %t1 : !stencil.temp) -> (!stencil.temp) { // CHECK-NEXT: %0 = stencil.access %one[0] : !stencil.temp // CHECK-NEXT: stencil.return %0 : f64 // CHECK-NEXT: } diff --git a/xdsl/transforms/canonicalize.py b/xdsl/transforms/canonicalize.py index 40d5d0d195..12cb59fe97 100644 --- a/xdsl/transforms/canonicalize.py +++ b/xdsl/transforms/canonicalize.py @@ -9,7 +9,7 @@ RewritePattern, ) from xdsl.traits import HasCanonicalizationPatternsTrait -from xdsl.transforms.dead_code_elimination import dce +from xdsl.transforms.dead_code_elimination import RemoveUnusedOperations class CanonicalizationRewritePattern(RewritePattern): @@ -34,5 +34,7 @@ class CanonicalizePass(ModulePass): name = "canonicalize" def apply(self, ctx: MLContext, op: builtin.ModuleOp) -> None: - PatternRewriteWalker(CanonicalizationRewritePattern()).rewrite_module(op) - dce(op) + pattern = GreedyRewritePatternApplier( + [RemoveUnusedOperations(), CanonicalizationRewritePattern()] + ) + PatternRewriteWalker(pattern).rewrite_module(op)