[clang] [CIR] Upstream support for lowering cir.switch to LLVM (PR #140425)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon May 19 14:06:41 PDT 2025


================
@@ -1038,6 +1038,37 @@ mlir::LogicalResult CIRToLLVMGlobalOpLowering::matchAndRewrite(
   return mlir::success();
 }
 
+mlir::LogicalResult CIRToLLVMSwitchFlatOpLowering::matchAndRewrite(
+    cir::SwitchFlatOp op, OpAdaptor adaptor,
+    mlir::ConversionPatternRewriter &rewriter) const {
+
+  llvm::SmallVector<mlir::APInt, 8> caseValues;
+  if (op.getCaseValues()) {
----------------
andykaylor wrote:

Is this `if` necessary? I think it there are no case values we just won't enter the `for` loop below.

https://github.com/llvm/llvm-project/pull/140425


More information about the cfe-commits mailing list