@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
https://github.com/andykaylor created
https://github.com/llvm/llvm-project/pull/134181
This adds ClangIR support for break and continue statements in loops.
Because only loops are currently implemented upstream in CIR, only breaks in
loops are supported here, but this same code will work (with
@@ -229,6 +229,10 @@ mlir::LogicalResult CIRGenFunction::emitSimpleStmt(const
Stmt *s,
else
emitCompoundStmt(cast(*s));
break;
+ case Stmt::ContinueStmtClass:
erichkeane wrote:
Won't let me choose a better line, but line 222 is not accurate any
https://github.com/andykaylor closed
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/134181
>From 54454e4d52570f29c493c41fc9bf95cbaf9e0886 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 21 Mar 2025 09:46:27 -0700
Subject: [PATCH 1/4] [CIR] Upstream support for break and continue statements
T
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
https://github.com/bcardosolopes approved this pull request.
LGTM after other reviews are applied.
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/134181
>From 54454e4d52570f29c493c41fc9bf95cbaf9e0886 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 21 Mar 2025 09:46:27 -0700
Subject: [PATCH 1/2] [CIR] Upstream support for break and continue statements
T
https://github.com/andykaylor updated
https://github.com/llvm/llvm-project/pull/134181
>From 54454e4d52570f29c493c41fc9bf95cbaf9e0886 Mon Sep 17 00:00:00 2001
From: Andy Kaylor
Date: Fri, 21 Mar 2025 09:46:27 -0700
Subject: [PATCH 1/3] [CIR] Upstream support for break and continue statements
T
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
https://github.com/erichkeane approved this pull request.
1 Possible nit, else LGTM.
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h --
clang/include/clang/CIR/Dialect/Builder/CIRBaseBuil
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
@@ -265,3 +265,125 @@ void test_empty_while_true() {
// OGCG: br label %[[WHILE_BODY:.*]]
// OGCG: [[WHILE_BODY]]:
// OGCG: ret void
+
+void unreachable_after_continue() {
+ for (;;) {
+continue;
+int x = 1;
+ }
+}
+
+// CIR: cir.func @unreachable_after_continue
+
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
https://github.com/xlauko edited
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator,
];
}
+//===--===//
+// BreakOp
+//===--===//
+
+def BreakOp : C
https://github.com/xlauko commented:
LGTM
https://github.com/llvm/llvm-project/pull/134181
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Andy Kaylor (andykaylor)
Changes
This adds ClangIR support for break and continue statements in loops.
Because only loops are currently implemented upstream in CIR, only breaks in
loops are supported here, but this same code will work (wi
25 matches
Mail list logo