@@ -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