Skip to content

[DAE2] Refinalize when changing types - #9290

Open
tlively wants to merge 1 commit into
mainfrom
dae2-refinalize
Open

tlively wants to merge 1 commit into
mainfrom
dae2-refinalize

Conversation

@tlively

@tlively tlively commented Oct 21, 2026

Copy link
Copy Markdown
Member

When DAE2 removes unused values, replacing an expression (such as a drop of a concrete block containing an unreachable child) with its kept children can change the expression's type from none to unreachable. Track when a replacement in Optimizer becomes unreachable and run ReFinalize in parallel on affected functions at the end of DAE2::optimize() after global type rewriting.

When `DAE2` removes unused values, replacing an expression (such as a `drop` of a concrete block containing an `unreachable` child) with its kept children can change the expression's type from `none` to `unreachable`. Track when a replacement in `Optimizer` becomes `unreachable` and run `ReFinalize` in parallel on affected functions at the end of `DAE2::optimize()` after global type rewriting.
@tlively
tlively requested a review from a team as a code owner October 21, 2026 01:35
@tlively
tlively requested review from aheejin and removed request for a team October 21, 2026 01:35

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a refinalization step in the Dead Argument Elimination (DAE2) pass to handle cases where removing unused expression results introduces new unreachability, requiring enclosing expressions to be refinalized. It adds a refinalize flag to FunctionInfo and runs a custom Refinalizer pass after global type rewriting to ensure correct type propagation for instructions like call_ref and ref.func. Test cases have been added to verify this behavior. There are no review comments, so I have no additional feedback to provide.

This branch has not been deployed

No deployments
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