@@ -464,9 +464,9 @@ LogicalResult mlir::loopUnrollByFactor(
464
464
return success ();
465
465
}
466
466
467
- LoopParams mlir::emitNormalizedLoopBounds (RewriterBase &rewriter, Location loc,
468
- OpFoldResult lb, OpFoldResult ub,
469
- OpFoldResult step) {
467
+ Range mlir::emitNormalizedLoopBounds (RewriterBase &rewriter, Location loc,
468
+ OpFoldResult lb, OpFoldResult ub,
469
+ OpFoldResult step) {
470
470
// For non-index types, generate `arith` instructions
471
471
// Check if the loop is already known to have a constant zero lower bound or
472
472
// a constant one step.
@@ -478,8 +478,8 @@ LoopParams mlir::emitNormalizedLoopBounds(RewriterBase &rewriter, Location loc,
478
478
if (auto stepCst = getConstantIntValue (step))
479
479
isStepOne = stepCst.value () == 1 ;
480
480
481
- Type loopParamsType = getType (lb);
482
- assert (loopParamsType == getType (ub) && loopParamsType == getType (step) &&
481
+ Type rangeType = getType (lb);
482
+ assert (rangeType == getType (ub) && rangeType == getType (step) &&
483
483
" expected matching types" );
484
484
485
485
// Compute the number of iterations the loop executes: ceildiv(ub - lb, step)
@@ -501,8 +501,8 @@ LoopParams mlir::emitNormalizedLoopBounds(RewriterBase &rewriter, Location loc,
501
501
getValueOrCreateConstantIntOp (rewriter, loc, step));
502
502
}
503
503
504
- OpFoldResult newLowerBound = rewriter.getZeroAttr (loopParamsType );
505
- OpFoldResult newStep = rewriter.getOneAttr (loopParamsType );
504
+ OpFoldResult newLowerBound = rewriter.getZeroAttr (rangeType );
505
+ OpFoldResult newStep = rewriter.getOneAttr (rangeType );
506
506
507
507
return {newLowerBound, newUpperBound, newStep};
508
508
}
@@ -626,18 +626,17 @@ LogicalResult mlir::coalesceLoops(RewriterBase &rewriter,
626
626
Value lb = loop.getLowerBound ();
627
627
Value ub = loop.getUpperBound ();
628
628
Value step = loop.getStep ();
629
- auto newLoopParams =
629
+ auto newLoopRange =
630
630
emitNormalizedLoopBounds (rewriter, loop.getLoc (), lb, ub, step);
631
631
632
632
rewriter.modifyOpInPlace (loop, [&]() {
633
- loop.setLowerBound (getValueOrCreateConstantIntOp (
634
- rewriter, loop. getLoc (), newLoopParams. lowerBound ));
635
- loop.setUpperBound (getValueOrCreateConstantIntOp (
636
- rewriter, loop. getLoc (), newLoopParams. upperBound ));
633
+ loop.setLowerBound (getValueOrCreateConstantIntOp (rewriter, loop. getLoc (),
634
+ newLoopRange. offset ));
635
+ loop.setUpperBound (getValueOrCreateConstantIntOp (rewriter, loop. getLoc (),
636
+ newLoopRange. size ));
637
637
loop.setStep (getValueOrCreateConstantIntOp (rewriter, loop.getLoc (),
638
- newLoopParams. step ));
638
+ newLoopRange. stride ));
639
639
});
640
-
641
640
rewriter.setInsertionPointToStart (innermost.getBody ());
642
641
denormalizeInductionVariable (rewriter, loop.getLoc (),
643
642
loop.getInductionVar (), lb, step);
@@ -780,9 +779,9 @@ void mlir::collapseParallelLoops(
780
779
Value lb = loops.getLowerBound ()[i];
781
780
Value ub = loops.getUpperBound ()[i];
782
781
Value step = loops.getStep ()[i];
783
- auto newLoopParams = emitNormalizedLoopBounds (rewriter, loc, lb, ub, step);
782
+ auto newLoopRange = emitNormalizedLoopBounds (rewriter, loc, lb, ub, step);
784
783
normalizedUpperBounds.push_back (getValueOrCreateConstantIntOp (
785
- rewriter, loops.getLoc (), newLoopParams. upperBound ));
784
+ rewriter, loops.getLoc (), newLoopRange. size ));
786
785
787
786
rewriter.setInsertionPointToStart (loops.getBody ());
788
787
denormalizeInductionVariable (rewriter, loc, loops.getInductionVars ()[i], lb,
0 commit comments