Skip to content

bugc: fix optimizer for nested call arguments in recursion#208

Merged
gnidan merged 1 commit intocall-returnfrom
compiler-fix-optimizer-recursion
Apr 2, 2026
Merged

bugc: fix optimizer for nested call arguments in recursion#208
gnidan merged 1 commit intocall-returnfrom
compiler-fix-optimizer-recursion

Conversation

@gnidan
Copy link
Copy Markdown
Member

@gnidan gnidan commented Apr 2, 2026

Summary

  • Moves phi resolution from target blocks to predecessor blocks (standard phi deconstruction), fixing back-edge resolution for TCO loops and for-loops
  • Fixes jump optimization eliminating phi-bearing blocks
  • Rewrites TCO to use a pre_entry trampoline with phis on the original entry block

Fixes the level 2+ optimizer failure with nested call arguments like count(succ(n), target).

Move phi resolution from target blocks to predecessor blocks
(standard phi deconstruction). The previous approach resolved
phis at the target using the layout-order predecessor, which
broke for back-edges where the runtime predecessor differs.

Also fixes jump optimization eliminating phi-bearing blocks
and rewrites TCO to use a pre_entry trampoline with phis on
the original entry block.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-04-02 12:36 UTC

@gnidan gnidan merged commit 8e257a5 into call-return Apr 2, 2026
4 checks passed
@gnidan gnidan deleted the compiler-fix-optimizer-recursion branch April 2, 2026 12:32
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.

1 participant