[clang] [CIR] Upstream support for break and continue statements (PR #134181)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 3 08:34:26 PDT 2025
================
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===----------------------------------------------------------------------===//
+// BreakOp
+//===----------------------------------------------------------------------===//
+
+def BreakOp : CIR_Op<"break", [Terminator]> {
+ let summary = "C/C++ `break` statement equivalent";
+ let description = [{
+ The `cir.break` operation is used to cease the control flow to the parent
+ operation, exiting its region's control flow. It is only allowed if it is
+ within a breakable operation (loops and `switch`).
+ }];
+ let assemblyFormat = "attr-dict";
+ let hasVerifier = 1;
+}
+
+//===----------------------------------------------------------------------===//
+// ContinueOp
+//===----------------------------------------------------------------------===//
+
+def ContinueOp : CIR_Op<"continue", [Terminator]> {
+ let summary = "C/C++ `continue` statement equivalent";
+ let description = [{
+ The `cir.continue` operation is used to continue execution to the next
----------------
erichkeane wrote:
```suggestion
The `cir.continue` operation is used end execution of the current iteration of the loop, and resume execution of the next
```
Or something like that.
https://github.com/llvm/llvm-project/pull/134181
More information about the cfe-commits
mailing list