[Mlir-commits] [mlir] [mlir][affine][Analysis] Add conservative bounds for semi-affine mods (PR #93576)

Benjamin Maxwell llvmlistbot at llvm.org
Wed May 29 09:48:20 PDT 2024


================
@@ -46,9 +46,15 @@ struct AffineExprFlattener : public SimpleAffineExprFlattener {
   // inequalities.
   IntegerPolyhedron localVarCst;
 
-  AffineExprFlattener(unsigned nDims, unsigned nSymbols)
+  AffineExprFlattener(unsigned nDims, unsigned nSymbols,
+                      bool addConservativeSemiAffineBounds = false)
       : SimpleAffineExprFlattener(nDims, nSymbols),
-        localVarCst(PresburgerSpace::getSetSpace(nDims, nSymbols)) {}
+        localVarCst(PresburgerSpace::getSetSpace(nDims, nSymbols)),
+        addConservativeSemiAffineBounds(addConservativeSemiAffineBounds) {}
+
+  bool hasUnhandledSemiAffineExpressions() const {
+    return unhandledSemiAffineExpressions;
+  }
----------------
MacDue wrote:

I've split this out into shared `AffineExprFlattenerWithLocalVars`, which is subclassed by `AffineExprFlattener` and `SemiAffineExprFlattener`. The `AffineExprFlattener` will fail if it encounters a semi-affine expression, and the `SemiAffineExprFlattener` will attempt to add an approximation.

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


More information about the Mlir-commits mailing list