[Mlir-commits] [mlir] [mlir][affine] Use value bound inference to determine minimum/maximum trip counts in loop analysis (PR #128113)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Tue Apr 8 09:18:58 PDT 2025


================
@@ -212,6 +214,40 @@ void mlir::affine::getTripCountMapAndOperands(
                             tripCountValueMap.getOperands().end());
 }
 
+/// Take the min if all trip counts are constant.
+static std::optional<uint64_t>
+getKnownTripCountBound(AffineMap map, SmallVectorImpl<Value> &operands,
+                       presburger::BoundType type) {
+  std::optional<uint64_t> tripCount;
+  for (auto resultExpr : map.getResults()) {
+    AffineMap subMap =
+        AffineMap::get(map.getNumDims(), map.getNumSymbols(), resultExpr);
----------------
ftynse wrote:

Nit: we have `AffineMap::getSubMap`.

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


More information about the Mlir-commits mailing list