[Mlir-commits] [mlir] [mlir][scf] Expose isPerfectlyNestedForLoops (PR #152115)

Mehdi Amini llvmlistbot at llvm.org
Mon Aug 25 07:19:27 PDT 2025


================
@@ -1512,3 +1512,47 @@ FailureOr<scf::ForallOp> mlir::normalizeForallOp(RewriterBase &rewriter,
   rewriter.replaceOp(forallOp, normalizedForallOp);
   return normalizedForallOp;
 }
+
+bool mlir::isPerfectlyNestedForLoops(
+    MutableArrayRef<LoopLikeOpInterface> loops) {
+  assert(!loops.empty() && "unexpected empty loop nest");
+  if (loops.size() == 1) {
+    return isa_and_nonnull<scf::ForOp>(loops.front().getOperation());
+  }
----------------
joker-eph wrote:

```suggestion
  if (loops.size() == 1)
    return isa_and_nonnull<scf::ForOp>(loops.front().getOperation());
```

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


More information about the Mlir-commits mailing list