[Mlir-commits] [mlir] [mlir] Extend affine.min/max ValueBoundsOpInterfaceImpls (PR #118840)
Matthias Springer
llvmlistbot at llvm.org
Tue Jan 21 00:06:49 PST 2025
================
@@ -67,6 +67,27 @@ struct AffineMinOpInterface
expr.replaceDimsAndSymbols(dimReplacements, symReplacements);
cstr.bound(value) <= bound;
}
+ // Get all constant lower bounds, choose minimum, and set lower bound to it.
+ MLIRContext *ctx = op->getContext();
+ AffineMap map = minOp.getAffineMap();
+ SmallVector<Value> mapOperands = minOp.getOperands();
+ std::optional<int64_t> minBound;
+ for (AffineExpr expr : map.getResults()) {
+ auto exprMap =
+ AffineMap::get(map.getNumDims(), map.getNumSymbols(), expr, ctx);
+ ValueBoundsConstraintSet::Variable exprVar(exprMap, mapOperands);
+ FailureOr<int64_t> exprBound =
+ cstr.computeConstantBound(presburger::BoundType::LB, exprVar,
----------------
matthias-springer wrote:
You can also take a look at `IfOpInterface::populateBounds`, which does something similar.
https://github.com/llvm/llvm-project/pull/118840
More information about the Mlir-commits
mailing list