[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 12:18:24 PDT 2025


================
@@ -962,6 +964,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 (const APInt &val : caseValues) {
----------------
andykaylor wrote:

Braces aren't needed here.

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


More information about the cfe-commits mailing list