Skip to content

Cranelift: fix a bug with inlining and unreachable callee blocks #11282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Jul 18, 2025

We copy all callee blocks into the caller's layout, but were then only copying the callee instructions in reachable callee blocks into the caller. Therefore, any unreachable blocks would remain empty in the caller, which is invalid CLIF because all blocks must end in a terminator, so this commit adds a quick pass over the inlined blocks to remove any empty blocks from the caller's layout.

We copy *all* callee blocks into the caller's layout, but were then only copying
the callee instructions in *reachable* callee blocks into the caller. Therefore,
any *unreachable* blocks would remain empty in the caller, which is invalid CLIF
because all blocks must end in a terminator, so this commit adds a quick pass
over the inlined blocks to remove any empty blocks from the caller's layout.
@fitzgen fitzgen requested a review from a team as a code owner July 18, 2025 22:55
@fitzgen fitzgen requested review from alexcrichton and removed request for a team July 18, 2025 22:55
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant