Skip to content

[TailCall] Fix intrinsic and unreachable calls - #9111

Merged
tlively merged 2 commits into
mainfrom
fix-tail-call
Sep 17, 2026
Merged

tlively merged 2 commits into
mainfrom
fix-tail-call

Conversation

@tlively

@tlively tlively commented Sep 17, 2026

Copy link
Copy Markdown
Member

Late in the development of the TailCall pass, we removed a run of DCE in a nested pass runner. It turns out that had been load bearing, because without it TailCall could optimize unreachable calls whose callee return types did not match the caller return type, producing invalid IR. Fix the bug by not optimizing unreachable calls, leaving them for a separate DCE pass to clean up instead.

Also fix the lowering of call.without.effects when it is used as a tail call. Previously intrinsic lowering would turn such a tail call into a normal call, again producing invalid IR because the normal call is not unreachable and is not valid in all the places a tail call would be.

Late in the development of the TailCall pass, we removed a run of DCE in a nested pass runner. It turns out that had been load bearing, because without it TailCall could optimize unreachable calls whose callee return types did not match the caller return type, producing invalid IR. Fix the bug by not optimizing unreachable calls, leaving them for a separate DCE pass to clean up instead.

Also fix the lowering of call.without.effects when it is used as a tail call. Previously intrinsic lowering would turn such a tail call into a normal call, again producing invalid IR because the normal call is not unreachable and is not valid in all the places a tail call would be.
@tlively
tlively requested a review from a team as a code owner September 17, 2026 04:17
@tlively
tlively requested review from aheejin and kripken and removed request for a team September 17, 2026 04:17
Comment thread test/lit/passes/tail-call.wast
Co-authored-by: Alon Zakai <azakai@google.com>
@tlively
tlively enabled auto-merge (squash) September 17, 2026 16:26
@tlively
tlively merged commit 7d27e49 into main Sep 17, 2026
16 checks passed
@tlively
tlively deleted the fix-tail-call branch September 17, 2026 16:52
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.

2 participants