Skip to content

Commit cbcfb86

Browse files
committed
incorporate comments
1 parent f8e5e5b commit cbcfb86

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ std::optional<uint64_t> mlir::affine::getConstantTripCount(AffineForOp forOp) {
109109

110110
void mlir::affine::replaceIterArgsAndYieldResults(AffineForOp forOp) {
111111
// Replace uses of iter arguments with iter operands (initial values).
112-
auto iterOperands = forOp.getInits();
113-
auto iterArgs = forOp.getRegionIterArgs();
114-
for (auto e : llvm::zip(iterOperands, iterArgs))
115-
std::get<1>(e).replaceAllUsesWith(std::get<0>(e));
112+
OperandRange iterOperands = forOp.getInits();
113+
MutableArrayRef<BlockArgument> iterArgs = forOp.getRegionIterArgs();
114+
for (auto [operand, arg] : llvm::zip(iterOperands, iterArgs))
115+
arg.replaceAllUsesWith(operand);
116116

117117
// Replace uses of loop results with the values yielded by the loop.
118-
auto outerResults = forOp.getResults();
119-
auto innerResults = forOp.getBody()->getTerminator()->getOperands();
120-
for (auto e : llvm::zip(outerResults, innerResults))
121-
std::get<0>(e).replaceAllUsesWith(std::get<1>(e));
118+
ResultRange outerResults = forOp.getResults();
119+
OperandRange innerResults = forOp.getBody()->getTerminator()->getOperands();
120+
for (auto [outer, inner] : llvm::zip(outerResults, innerResults))
121+
outer.replaceAllUsesWith(inner);
122122
}
123123

124124
/// Returns the greatest known integral divisor of the trip count. Affine

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,17 +2455,17 @@ LogicalResult AffineForOp::promoteIfSingleIteration(RewriterBase &rewriter) {
24552455
return failure();
24562456

24572457
// Replaces all IV uses to its single iteration value.
2458-
auto iv = forOp.getInductionVar();
2459-
auto *parentBlock = forOp->getBlock();
2458+
BlockArgument iv = forOp.getInductionVar();
2459+
Block *parentBlock = forOp->getBlock();
24602460
if (!iv.use_empty()) {
24612461
if (forOp.hasConstantLowerBound()) {
24622462
OpBuilder topBuilder(forOp->getParentOfType<func::FuncOp>().getBody());
24632463
auto constOp = topBuilder.create<arith::ConstantIndexOp>(
24642464
forOp.getLoc(), forOp.getConstantLowerBound());
24652465
iv.replaceAllUsesWith(constOp);
24662466
} else {
2467-
auto lbOperands = forOp.getLowerBoundOperands();
2468-
auto lbMap = forOp.getLowerBoundMap();
2467+
OperandRange lbOperands = forOp.getLowerBoundOperands();
2468+
AffineMap lbMap = forOp.getLowerBoundMap();
24692469
OpBuilder builder(forOp);
24702470
if (lbMap == builder.getDimIdentityMap()) {
24712471
// No need of generating an affine.apply.

0 commit comments

Comments
 (0)