Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Jan 6, 2026

IRBuilder has to handle the case where a branching instruction like
br_on_null sends a value to its target label, even though we cannot
directly represent such a value being sent in our IR. To do so, it adds
an extra trampoline label that fetches the sent value out of scratch
locals before branching to the original target.

We previously had an assertion that the scratch local used to hold such
extra values had the same type as the expression with the destination
label. This is usually true, but it is possible that the destination
label is on an If with an unreachable condition, in which case the
destination has type unreachable and the scratch local has the original
concrete label type. Remove the incorrect assertion.

Fixes #8096.

IRBuilder has to handle the case where a branching instruction like
br_on_null sends a value to its target label, even though we cannot
directly represent such a value being sent in our IR. To do so, it adds
an extra trampoline label that fetches the sent value out of scratch
locals before branching to the original target.

We previously had an assertion that the scratch local used to hold such
extra values had the same type as the expression with the destination
label. This is usually true, but it is possible that the destination
label is on an If with an unreachable condition, in which case the
destination has type unreachable and the scratch local has the original
concrete label type. Remove the incorrect assertion.

Fixes #8096.
@tlively tlively merged commit d2bf202 into main Jan 6, 2026
17 checks passed
@tlively tlively deleted the ir-builder-bad-assert-if-label branch January 6, 2026 16:50
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.

[Bug] Assertion failed extraType == labelType in wasm::IRBuilder::fixExtraOutput

3 participants