[clang] [CIR] Defer indirect goto resolution to GotoSolver (PR #206176)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 28 11:57:54 PDT 2026
================
@@ -60,3 +60,31 @@ cir.func @c() {
// CHECK: cir.label "label1"
----------------
Andres-Salamanca wrote:
Should we add a test covering the case where a `LabelOp` is placed in the entry block?
LLVM does not permit branches targeting the entry block. That's why both CIRGen and the lowering check `currBlock->isEntryBlock()` and, if necessary, create a new block containing the `LabelOp`, branching to that block instead.
Should `GotoSolver` handle this case as well? For example, if it directly receives a target `LabelOp` in the entry block, should it also create the additional block before resolving the goto?
Alternatively, would it make sense to enforce this as an IR invariant by adding a verifier to `LabelOp` that rejects labels in the entry block?
https://github.com/llvm/llvm-project/pull/206176
More information about the cfe-commits
mailing list