Skip to content

Conversation

@Andres-Salamanca
Copy link
Contributor

This PR fixes an error I found while working on cir.indirectbr. The issue occurs when a branching operator points to the entry block LLVM’s verifier does not allow this

if (!firstBB->hasNoPredecessors())
return emitError(op.getLoc(),
"entry block of region may not have predecessors");
}

Previously, in cir.label, when building a block, we only checked if the current block was not empty. Now, we also check if we are in the entry block. If we are, a new block is created instead.
This change also helps emit IR that is closer to the classic code behavior.

Copy link
Collaborator

@andykaylor andykaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bcardosolopes bcardosolopes merged commit c45b338 into llvm:main Oct 9, 2025
10 checks passed
Andres-Salamanca added a commit to llvm/llvm-project that referenced this pull request Oct 15, 2025
This PR fixes an error I found while working on cir.indirectbr. The
issue occurs when a branching operator points to the entry block LLVM’s
verifier does not allow this.
This PR is the same as the one I submitted in the
incubator:llvm/clangir#1939
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 15, 2025
…ock (#163280)

This PR fixes an error I found while working on cir.indirectbr. The
issue occurs when a branching operator points to the entry block LLVM’s
verifier does not allow this.
This PR is the same as the one I submitted in the
incubator:llvm/clangir#1939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants