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

Ivan Butygin llvmlistbot at llvm.org
Fri Jun 7 14:25:13 PDT 2024


================
@@ -120,52 +85,92 @@ class DataFlowListener : public RewriterBase::Listener {
   DataFlowSolver &s;
 };
 
-struct ConvertCmpOp : public OpRewritePattern<arith::CmpIOp> {
+/// Rewrite any results of `op` that were inferred to be constant integers to
+/// and replace their uses with that constant. Return success() if all results
+/// where thus replaced and the operation is erased. Also replace any block
+/// arguments with their constant values.
+struct MaterializeKnownConstantValues : public RewritePattern {
+  MaterializeKnownConstantValues(MLIRContext *context, DataFlowSolver &s)
+      : RewritePattern(Pattern::MatchAnyOpTypeTag(), 1, context), solver(s) {}
----------------
Hardcode84 wrote:

`/*benefit*/ 1`

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


More information about the Mlir-commits mailing list