Stream: git-wasmtime

Topic: wasmtime / PR #13251 Implement idempotent-store elimination


view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen opened PR #13251 from fitzgen:wasmtime-idempotent-store-elimination to bytecodealliance:main:

This is a very particular subset of "dead-store elimination" that we can do without extending the static analysis at all (e.g. we do not need to show that the target store is post-dominated by another store to the same location in this case). The key idea is this: if our existing analysis tells us that a memory location L is currently known to contain the value v0 (such that we could do redundant-load elimination by removing v8 = load L and making v8 an alias of v0) then we can remove store v0, L because memory location L already contains that value. We also do not need to worry about traps because if L already has a known-value, that must have been from a load or store to L that dominates our idempotent store instruction, and if this idempotent store would trap, then the original load/store to L would have already trapped first.

This does not result in any statistically significant differences in Sightglass.

cc https://github.com/bytecodealliance/wasmtime/issues/4167

<!--
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 (May 01 2026 at 21:41):

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

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen requested uweigand for a review on PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen requested alexcrichton for a review on PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen requested wasmtime-core-reviewers for a review on PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen unassigned uweigand from PR #13251 Implement idempotent-store elimination.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen requested cfallin for a review on PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:41):

fitzgen unassigned alexcrichton from PR #13251 Implement idempotent-store elimination.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:53):

:thumbs_up: cfallin submitted PR review:

LGTM with minor tweaks -- thanks!

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:53):

:speech_balloon: cfallin created PR review comment:

any reason to remove this comment?

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:53):

:speech_balloon: cfallin created PR review comment:

likewise, any reason to remove this?

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:53):

:speech_balloon: cfallin created PR review comment:

might be helpful to add a set of split stats (alias_analysis_removed_load + alias_analysis_removed_store) here too, in case we want to see how effective this is whenever we have a good way of consuming stats!

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 21:53):

:speech_balloon: cfallin created PR review comment:

This is technically true but block1 doesn't even branch to block2 (and there is no path from 1 to 2). A more interesting test might be one where we have stores in two blocks, one of which branches to another, but the second also has another side-entrance (another in-edge) -- something like:

block1:
  brif ..., block2, block3

block2:
  store
  jump block4

block3:
  jump block4

block4:
  store    ; should not be removed

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 22:06):

:memo: fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 22:06):

:speech_balloon: fitzgen created PR review comment:

whoops, just got lost in the shuffle

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 22:08):

fitzgen updated PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 22:08):

fitzgen has enabled auto merge for PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 22:21):

fitzgen added PR #13251 Implement idempotent-store elimination to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 22:46):

github-merge-queue[bot] removed PR #13251 Implement idempotent-store elimination from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 23:27):

fitzgen added PR #13251 Implement idempotent-store elimination to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 23:53):

:check: fitzgen merged PR #13251.

view this post on Zulip Wasmtime GitHub notifications bot (May 01 2026 at 23:53):

fitzgen removed PR #13251 Implement idempotent-store elimination from the merge queue.


Last updated: May 03 2026 at 22:13 UTC