[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu May 8 16:16:19 PDT 2025
================
@@ -962,6 +963,102 @@ bool cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl<CaseOp> &cases) {
});
}
+//===----------------------------------------------------------------------===//
+// SwitchFlatOp
+//===----------------------------------------------------------------------===//
+
+void cir::SwitchFlatOp::build(OpBuilder &builder, OperationState &result,
+ Value value, Block *defaultDestination,
+ ValueRange defaultOperands,
+ ArrayRef<APInt> caseValues,
+ BlockRange caseDestinations,
+ ArrayRef<ValueRange> caseOperands) {
+
+ std::vector<mlir::Attribute> caseValuesAttrs;
+ for (auto &val : caseValues) {
----------------
andykaylor wrote:
```suggestion
for (APInt &val : caseValues) {
```
Also, braces aren't needed here.
https://github.com/llvm/llvm-project/pull/139154
More information about the cfe-commits
mailing list