Stream: git-wasmtime

Topic: wasmtime / PR #11205 Cranelift: Fix DFS iteration duplica...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 01:44):

fitzgen opened PR #11205 from fitzgen:dfs-duplicate-visits to bytecodealliance:main:

When a single instruction could branch to the same successor multiple different ways (e.g. both sides of a brif go to the same block, or a block appears multiple times in a br_table or a try_call's exception table) then our DFS traversal would mistakenly visit that block multiple times. This has largely not been an issue for analyses, just made them a tiny bit slower, but would be problematic for traversals that mutate the IR. Luckily the only traversal that is currently based on these DFS iteration helpers is the safepoints pass in cranelift-frontend, and that uses the post-order DFS iterator, which was not affected by this bug by chance. (My upcoming inliner, on the other hand, uses the pre-order DFS iterator and was affected by this bug.)

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 01:44):

fitzgen requested wasmtime-compiler-reviewers for a review on PR #11205.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 01:44):

fitzgen requested alexcrichton for a review on PR #11205.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 01:46):

fitzgen updated PR #11205.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 01:50):

fitzgen edited PR #11205:

When a single instruction could branch to the same successor multiple different ways (e.g. both sides of a brif go to the same block, or a block appears multiple times in a br_table or a try_call's exception table) then our DFS traversal would mistakenly visit that block multiple times. This has largely not been an issue for analyses, just made them a tiny bit slower, but would be problematic for traversals that mutate the IR. Luckily the only mutating traversal that is currently based on these DFS iteration helpers is the safepoints pass in cranelift-frontend, and that uses the post-order DFS iterator, which was not affected by this bug by chance. (My upcoming inliner, on the other hand, uses the pre-order DFS iterator and was affected by this bug.)

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 14:35):

alexcrichton submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 09 2025 at 14:58):

alexcrichton merged PR #11205.


Last updated: Dec 06 2025 at 07:03 UTC