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

Uday Bondhugula via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 20:46:47 PDT 2020


bondhugula created this revision.
bondhugula added reviewers: rriddle, lattner, mehdi_amini.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar.
Herald added a project: LLVM.

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.

Depends on D77478 <https://reviews.llvm.org/D77478>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77483

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


Index: mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
===================================================================
--- mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -165,6 +165,7 @@
       if (isOpTriviallyDead(op)) {
         notifyOperationRemoved(op);
         op->erase();
+        changed = true;
         continue;
       }
 
@@ -186,7 +187,7 @@
 
       // Try to fold this op.
       if (succeeded(folder.tryToFold(op, collectOps, preReplaceAction))) {
-        changed |= true;
+        changed = true;
         continue;
       }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77483.255106.patch
Type: text/x-patch
Size: 634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200405/6a915a8e/attachment.bin>


More information about the llvm-commits mailing list