[Mlir-commits] [mlir] 673e982 - [MLIR] Fix iteration counting in greedy pattern application

Frederik Gossen llvmlistbot at llvm.org
Thu Apr 21 12:17:46 PDT 2022


Author: Frederik Gossen
Date: 2022-04-21T15:17:28-04:00
New Revision: 673e9828be2ce1af1b2ab88265c7e2b28f9a8dd6

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

LOG: [MLIR] Fix iteration counting in greedy pattern application

Previously, checking that a fix point is reached was counted as a full
iteration. As this "iteration" never changes the IR, this seems counter-
intuitive.

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

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 8043f604f9b4a..0b80cd66459bd 100644
--- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
+++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp
@@ -274,7 +274,7 @@ bool GreedyPatternRewriteDriver::simplify(MutableArrayRef<Region> regions) {
     if (config.enableRegionSimplification)
       changed |= succeeded(simplifyRegions(*this, regions));
   } while (changed &&
-           (++iteration < config.maxIterations ||
+           (iteration++ < config.maxIterations ||
             config.maxIterations == GreedyRewriteConfig::kNoIterationLimit));
 
   // Whether the rewrite converges, i.e. wasn't changed in the last iteration.


        


More information about the Mlir-commits mailing list