[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-05 Thread Andy Kaylor via cfe-commits
@@ -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 +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-05 Thread Andy Kaylor via cfe-commits
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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Andy Kaylor via cfe-commits
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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Andy Kaylor via 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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Andy Kaylor via cfe-commits
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, ]; } +//===--===// +// BreakOp +//===--===// + +def BreakOp : C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Erich Keane via cfe-commits
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, ]; } +//===--===// +// BreakOp +//===--===// + +def BreakOp : C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-04 Thread Bruno Cardoso Lopes via cfe-commits
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/

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Andy Kaylor via 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/2] [CIR] Upstream support for break and continue statements T

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Andy Kaylor via 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/3] [CIR] Upstream support for break and continue statements T

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
@@ -569,6 +569,36 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, ]; } +//===--===// +// BreakOp +//===--===// + +def BreakOp : C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread via 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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
@@ -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 +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
@@ -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 +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Bruno Cardoso Lopes via cfe-commits
@@ -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 +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Bruno Cardoso Lopes via cfe-commits
@@ -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 +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
@@ -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 +

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, ]; } +//===--===// +// BreakOp +//===--===// + +def BreakOp : C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Erich Keane via cfe-commits
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, ]; } +//===--===// +// BreakOp +//===--===// + +def BreakOp : C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Henrich Lauko via cfe-commits
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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Henrich Lauko via cfe-commits
@@ -569,6 +569,35 @@ def YieldOp : CIR_Op<"yield", [ReturnLike, Terminator, ]; } +//===--===// +// BreakOp +//===--===// + +def BreakOp : C

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-03 Thread Henrich Lauko via cfe-commits
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

[clang] [CIR] Upstream support for break and continue statements (PR #134181)

2025-04-02 Thread via 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