[Mlir-commits] [mlir] f875e55 - [MLIR] fix greedy pattern rewrite driver iteration on change

Uday Bondhugula llvmlistbot at llvm.org
Sun Apr 5 06:47:05 PDT 2020


Author: Uday Bondhugula
Date: 2020-04-05T19:15:46+05:30
New Revision: f875e55ba92732a20b0be2e4f11046c79ff0c22a

URL: https://github.com/llvm/llvm-project/commit/f875e55ba92732a20b0be2e4f11046c79ff0c22a
DIFF: https://github.com/llvm/llvm-project/commit/f875e55ba92732a20b0be2e4f11046c79ff0c22a.diff

LOG: [MLIR] fix greedy pattern rewrite driver iteration on change

Removing dead ops should make the outer loop of the pattern rewriting
driver run again. Although its operands are added to the worklist, if no
changes happenned to them or remaining ops in the worklist, the driver
wouldn't run once again - but it should be.

Differential Revision: https://reviews.llvm.org/D77483

Added: 
    

Modified: 
    mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
index e40a4d998221..2a5f3167d105 100644
--- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -165,6 +165,7 @@ bool GreedyPatternRewriteDriver::simplify(MutableArrayRef<Region> regions,
       if (isOpTriviallyDead(op)) {
         notifyOperationRemoved(op);
         op->erase();
+        changed = true;
         continue;
       }
 
@@ -186,7 +187,7 @@ bool GreedyPatternRewriteDriver::simplify(MutableArrayRef<Region> regions,
 
       // Try to fold this op.
       if (succeeded(folder.tryToFold(op, collectOps, preReplaceAction))) {
-        changed |= true;
+        changed = true;
         continue;
       }
 


        


More information about the Mlir-commits mailing list