Skip to content

[test] Check that backwards branches trim the stack#2082

Merged
rossberg merged 1 commit intoWebAssembly:mainfrom
Sainan:check-loop-implicit-drop
Feb 13, 2026
Merged

[test] Check that backwards branches trim the stack#2082
rossberg merged 1 commit intoWebAssembly:mainfrom
Sainan:check-loop-implicit-drop

Conversation

@Sainan
Copy link
Contributor

@Sainan Sainan commented Feb 12, 2026

Wasn't really sure where to put it or what to call it, but I hope this is fine.

Closes #2080

@tlively
Copy link
Member

tlively commented Feb 12, 2026

test/core/br_if.wast would probably be a better location since this is part of the behavior of br_if more than loops.

@Sainan Sainan force-pushed the check-loop-implicit-drop branch from a1b91d4 to 73fbf32 Compare February 12, 2026 20:01
@Sainan
Copy link
Contributor Author

Sainan commented Feb 12, 2026

Alright, moved it there.

@tlively tlively requested a review from rossberg February 12, 2026 20:23
Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

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

We have many tests that test this property of br_if (e.g., various of the as-* ones in this file). But they all target block by default. So I would argue this is more specific to loops, because it tests back edges in particular. We can put it into br_if.wast, but then I would expect equivalent additions to the other br* files.

It would be good to also have a variant that passes some loop parameters.

@Sainan
Copy link
Contributor Author

Sainan commented Feb 13, 2026

I did try writing this using br initially but I kept producing non-terminating code. I do suspect br_if is unavoidable for this test.

@rossberg
Copy link
Member

You'll need a separate branch for terminating the loop. It's probably not worht it, but then I think it makes more sense to keep the test in loop.wast (sorry for the churn :) ).

@Sainan Sainan force-pushed the check-loop-implicit-drop branch from 73fbf32 to a1b91d4 Compare February 13, 2026 10:59
@Sainan
Copy link
Contributor Author

Sainan commented Feb 13, 2026

Okay, pointed the branch at a1b91d4 again ☺️

@rossberg rossberg merged commit 9cac9a6 into WebAssembly:main Feb 13, 2026
2 checks passed
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.

Tests don't check that backwards branches implicitly trim the stack

3 participants