[Mlir-commits] [mlir] [mlir][scf] Fuse parallel loops with equal constant bounds (PR #218450)

Matthias Springer llvmlistbot at llvm.org
Tue Aug 25 00:55:53 PDT 2026


================
@@ -65,10 +66,23 @@ static bool equalIterationSpaces(ParallelOp firstPloop,
   if (firstPloop.getNumLoops() != secondPloop.getNumLoops())
     return false;
 
+  // Two bounds match if they are the same value, or if both are constants
+  // holding the same value. The latter matters because equivalent bounds are
+  // often materialized by distinct `arith.constant` ops, which leaves the
+  // iteration spaces equal even though the SSA values differ.
   auto matchOperands = [&](const OperandRange &lhs,
                            const OperandRange &rhs) -> bool {
-    // TODO: Extend this to support aliases and equal constants.
-    return std::equal(lhs.begin(), lhs.end(), rhs.begin());
+    // TODO: Extend this to support aliases.
----------------
matthias-springer wrote:

Note: This could be achieved via `ValueBoundsConstraintSet::areEqual`, however, it comes at a runtime cost.

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


More information about the Mlir-commits mailing list