[Mlir-commits] [mlir] [mlir][Arith] Generalize and improve -int-range-optimizations (PR #94712)

Krzysztof Drewniak llvmlistbot at llvm.org
Fri Jun 7 08:36:44 PDT 2024


================
@@ -185,25 +176,11 @@ struct IntRangeOptimizationsPass
     if (failed(solver.initializeAndRun(op)))
       return signalPassFailure();
 
-    DataFlowListener listener(solver);
-
-    RewritePatternSet patterns(ctx);
-    populateIntRangeOptimizationsPatterns(patterns, solver);
-
-    GreedyRewriteConfig config;
-    config.listener = &listener;
-
-    if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns), config)))
-      signalPassFailure();
+    doRewrites(solver, ctx, op->getRegions());
   }
 };
 } // namespace
 
-void mlir::arith::populateIntRangeOptimizationsPatterns(
----------------
krzysz00 wrote:

There was a part of me that wanted to make these rewrites into patterns (using the match any operation setup) but there didn't seem to be a nice way to do it, especially since we're targeting block arguments.

(This PR came from the fact that our downstream has had a copy-pasted and hacked-on version of the test pass from when I first made the range analysis, and once I saw someone had made a `-int-range-optimizations`, I figured that code should migrate in to it)

https://github.com/llvm/llvm-project/pull/94712


More information about the Mlir-commits mailing list