Skip to content

Commit 602f0ca

Browse files
Apply review
1 parent 384ec29 commit 602f0ca

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,23 +1043,19 @@ mlir::LogicalResult CIRToLLVMSwitchFlatOpLowering::matchAndRewrite(
10431043
mlir::ConversionPatternRewriter &rewriter) const {
10441044

10451045
llvm::SmallVector<mlir::APInt, 8> caseValues;
1046-
if (op.getCaseValues()) {
1047-
for (mlir::Attribute val : op.getCaseValues()) {
1048-
auto intAttr = dyn_cast<cir::IntAttr>(val);
1049-
caseValues.push_back(intAttr.getValue());
1050-
}
1046+
for (mlir::Attribute val : op.getCaseValues()) {
1047+
auto intAttr = cast<cir::IntAttr>(val);
1048+
caseValues.push_back(intAttr.getValue());
10511049
}
10521050

10531051
llvm::SmallVector<mlir::Block *, 8> caseDestinations;
10541052
llvm::SmallVector<mlir::ValueRange, 8> caseOperands;
10551053

1056-
for (mlir::Block *x : op.getCaseDestinations()) {
1054+
for (mlir::Block *x : op.getCaseDestinations())
10571055
caseDestinations.push_back(x);
1058-
}
10591056

1060-
for (mlir::OperandRange x : op.getCaseOperands()) {
1057+
for (mlir::OperandRange x : op.getCaseOperands())
10611058
caseOperands.push_back(x);
1062-
}
10631059

10641060
// Set switch op to branch to the newly created blocks.
10651061
rewriter.setInsertionPoint(op);

0 commit comments

Comments
 (0)