[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:40 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()) {
+ for (mlir::Attribute val : op.getCaseValues()) {
+ auto intAttr = dyn_cast<cir::IntAttr>(val);
----------------
andykaylor wrote:
```suggestion
auto intAttr = cast<cir::IntAttr>(val);
```
Make this assert.
https://github.com/llvm/llvm-project/pull/140425
More information about the cfe-commits
mailing list