@@ -360,7 +360,8 @@ class CIRSwitchOpFlattening : public mlir::OpRewritePattern<cir::SwitchOp> {
360
360
rewriter.eraseOp (caseOp);
361
361
}
362
362
363
- for (auto [index, rangeVal] : llvm::enumerate (rangeValues)) {
363
+ for (auto [rangeVal, operand, destination] :
364
+ llvm::zip (rangeValues, rangeOperands, rangeDestinations)) {
364
365
APInt lowerBound = rangeVal.first ;
365
366
APInt upperBound = rangeVal.second ;
366
367
@@ -376,16 +377,16 @@ class CIRSwitchOpFlattening : public mlir::OpRewritePattern<cir::SwitchOp> {
376
377
for (APInt iValue = lowerBound; iValue.sle (upperBound);
377
378
(void )iValue++) {
378
379
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 );
381
382
}
382
383
continue ;
383
384
}
384
385
385
386
defaultDestination =
386
- condBrToRangeDestination (op, rewriter, rangeDestinations[index] ,
387
+ condBrToRangeDestination (op, rewriter, destination ,
387
388
defaultDestination, lowerBound, upperBound);
388
- defaultOperands = rangeOperands[index] ;
389
+ defaultOperands = operand ;
389
390
}
390
391
391
392
// Set switch op to branch to the newly created blocks.
0 commit comments