[Mlir-commits] [mlir] [MLIR][SCF] Fix normalizeForallOp helper function (PR #138615)
Matteo Franciolini
llvmlistbot at llvm.org
Tue May 6 15:19:22 PDT 2025
================
@@ -1482,30 +1482,31 @@ FailureOr<scf::ForallOp> mlir::normalizeForallOp(RewriterBase &rewriter,
SmallVector<OpFoldResult> ubs = forallOp.getMixedUpperBound();
SmallVector<OpFoldResult> steps = forallOp.getMixedStep();
- if (llvm::all_of(
- lbs, [](OpFoldResult ofr) { return isConstantIntValue(ofr, 0); }) &&
- llvm::all_of(
- steps, [](OpFoldResult ofr) { return isConstantIntValue(ofr, 1); })) {
+ if (forallOp.isNormalized())
return forallOp;
- }
- SmallVector<OpFoldResult> newLbs, newUbs, newSteps;
+ OpBuilder::InsertionGuard g(rewriter);
+ rewriter.setInsertionPoint(forallOp);
+ SmallVector<OpFoldResult> newUbs;
for (auto [lb, ub, step] : llvm::zip_equal(lbs, ubs, steps)) {
Range normalizedLoopParams =
emitNormalizedLoopBounds(rewriter, forallOp.getLoc(), lb, ub, step);
- newLbs.push_back(normalizedLoopParams.offset);
newUbs.push_back(normalizedLoopParams.size);
- newSteps.push_back(normalizedLoopParams.stride);
}
+ (void)foldDynamicIndexList(newUbs);
----------------
mfrancio wrote:
Fair.
https://github.com/llvm/llvm-project/pull/138615
More information about the Mlir-commits
mailing list