Skip to content

Commit 9e40189

Browse files
change enumerate to zip
1 parent ad9dfc6 commit 9e40189

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ class CIRSwitchOpFlattening : public mlir::OpRewritePattern<cir::SwitchOp> {
360360
rewriter.eraseOp(caseOp);
361361
}
362362

363-
for (auto [index, rangeVal] : llvm::enumerate(rangeValues)) {
363+
for (auto [rangeVal, operand, destination] :
364+
llvm::zip(rangeValues, rangeOperands, rangeDestinations)) {
364365
APInt lowerBound = rangeVal.first;
365366
APInt upperBound = rangeVal.second;
366367

@@ -376,16 +377,16 @@ class CIRSwitchOpFlattening : public mlir::OpRewritePattern<cir::SwitchOp> {
376377
for (APInt iValue = lowerBound; iValue.sle(upperBound);
377378
(void)iValue++) {
378379
caseValues.push_back(iValue);
379-
caseOperands.push_back(rangeOperands[index]);
380-
caseDestinations.push_back(rangeDestinations[index]);
380+
caseOperands.push_back(operand);
381+
caseDestinations.push_back(destination);
381382
}
382383
continue;
383384
}
384385

385386
defaultDestination =
386-
condBrToRangeDestination(op, rewriter, rangeDestinations[index],
387+
condBrToRangeDestination(op, rewriter, destination,
387388
defaultDestination, lowerBound, upperBound);
388-
defaultOperands = rangeOperands[index];
389+
defaultOperands = operand;
389390
}
390391

391392
// Set switch op to branch to the newly created blocks.

0 commit comments

Comments
 (0)