Skip to content

Fix for call.without.effects in DAE2 - #9405

Merged
stevenfontanella merged 1 commit into
mainfrom
dae2-call-without-effects
Nov 20, 2026
Merged

stevenfontanella merged 1 commit into
mainfrom
dae2-call-without-effects

Conversation

@stevenfontanella

@stevenfontanella stevenfontanella commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

The pass previously assumed that the last argument of call.without.effects is always a ref.func expression which isn't always true. Change the code to make types that are the target of call.without.effects unrewritable.

There's no need to note the special case of ref.func separately. If another function shares a type with the function that is the target of call.without.effects, it will anyway be optimized if the function is private and can't escape (e.g. if it never appears in a ref.func expression), and not optimized otherwise (whether callWithoutEffectsTypes is changed or not).

Fixes #9404.

Comment on lines +626 to +627
funcInfos[index].callWithoutEffectsTypes.insert(
target->type.getHeapType());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not going to be thread-safe. We should instead collect the set of observed callWithoutEffects types on each function in parallel, then merge all the sets after the parallel pass.

@stevenfontanella stevenfontanella Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I believe that's what we're already doing here, we only touch funcInfos[index] which is the funcInfo for the particular function that this parallel Pass instance is looking at. Then we aggregate them on line 772. The earlier version needed an atomic<bool> because it directly mutated the funcInfo for the called target which we don't do anymore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, right you are.

@stevenfontanella
stevenfontanella marked this pull request as ready for review November 20, 2026 00:13
@stevenfontanella
stevenfontanella merged commit 326708d into main Nov 20, 2026
20 checks passed
@stevenfontanella
stevenfontanella deleted the dae2-call-without-effects branch November 20, 2026 07:42
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.

DAE2 crashes on call.without.effects with a non ref.func expression

2 participants