agourakis82 opened PR #14636 from agourakis82:fix/14573-divergent-store to bytecodealliance:main:
Fixes #14573.
Dead-store elimination can remove a trapping store before a loop because a later store post-dominates it. If execution stays in the loop, the overwriter never executes, turning an immediate trap into a hang.
Mark the last-store state as observed on CFG edges that do not decrease DFS postorder. Every cycle contains such an edge, including irreducible cycles. This conservatively limits DSE across cycles while retaining cross-block elimination in acyclic control flow.
The regression test covers infinite loops, loops with exit edges, stores in divergent blocks, irreducible cycles, non-trapping stores, and an acyclic control case.
Validation:
- 49 alias filetests passed.
- 212 cranelift-codegen library tests passed.
- Formatting and diff checks passed.
- A local concurrent shared-memory experiment observed the intermediate store with the patch and failed against the original revision.
The shared-memory experiment is supplementary evidence because it depends on thread scheduling. A local debug-build timing comparison measured a 2.05% increase in median end-to-end filetest time; production throughput and isolated pass cost have not been measured.
Signed-off-by: Demetrios Agourakis <demetrios@agourakis.med.br><!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
agourakis82 requested fitzgen for a review on PR #14636.
agourakis82 requested wasmtime-compiler-reviewers for a review on PR #14636.
:cross_mark: cfallin closed without merge PR #14636.
cfallin commented on PR #14636:
#14632 already fixes this and is in the merge queue, so closing this as a duplicate fix -- thanks though!
Last updated: Oct 11 2026 at 04:10 UTC