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
brifgo to the same block, or a block appears multiple times in abr_tableor atry_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 incranelift-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:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen requested wasmtime-compiler-reviewers for a review on PR #11205.
fitzgen requested alexcrichton for a review on PR #11205.
fitzgen updated PR #11205.
fitzgen edited PR #11205:
When a single instruction could branch to the same successor multiple different ways (e.g. both sides of a
brifgo to the same block, or a block appears multiple times in abr_tableor atry_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 incranelift-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:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton submitted PR review.
alexcrichton merged PR #11205.
Last updated: Dec 06 2025 at 07:03 UTC