TastyCZ opened PR #15029 from TastyCZ:cranelift-volatile-classify-late to bytecodealliance:main:
Follow-up to #14999, for the compile-time regression in bytecodealliance/are-we-fast-yet#12.
#14999 made
classifyin alias analysis look up the memflags of every instruction, before any of its opcode checks, to find volatile accesses. This moves the check to whereclassifyalready reads the memflags of loads and stores: a store's while finding its alias region, and a load's while finding which regions it observes (that lookup is now shared withalias_regions_observed, which used to do it twice). Volatile loads and stores are still fences, so behaviour doesn't change. I also added a filetest for a volatile store in an alias region, the one case where a store is a fence only because it is volatile; nothing covered it before.Compilation, instructions retired, against #14999's parent (fdc343eaffbb):
Geomean (default suite, 29 benchmarks) hashset#14999 +0.94% +1.44% #14999 + this PR +0.13% +0.16% #14999 with the classifycheck removed (reference only)+0.05% +0.05% So this recovers about 86% of the geomean regression (89% for
hashset). In virtual cycles the geomean goes from +0.70% to -0.04%. On currentmainthis PR is -0.81% geomean and -1.26% onhashset.How I measured: Sightglass at 2d453335 (the issue's commit), each engine built like
engines/wasmtime/build.rs(release,CODEGEN_UNITS=1), with the issue's engine flags and--measure callgrind --benchmark-phase compilation, Valgrind 3.26.0. Forhashset, #14999 and its parent ran 6 iterations each, as in the issue, and give the same +1.44%. For the full suite I ran one iteration per engine and benchmark, since callgrind's counts repeated to within 0.001%. The "this PR" rows are this commit applied to #14999 itself, so nothing else that landed since is mixed in.Tests:
cargo test -p cranelift-codegen, the filetests (cargo test -p cranelift-tools --test filetestsandclif-util test cranelift/filetests/filetests), and clippy oncranelift-codegenall pass. The new filetest fails when the volatile-store check is removed.
TastyCZ removed the review request for wasmtime-compiler-reviewers from PR #15029.
TastyCZ requested cfallin for a review on PR #15029.
TastyCZ requested wasmtime-compiler-reviewers for a review on PR #15029.
:thumbs_up: fitzgen submitted PR review:
Thanks!
fitzgen added PR #15029 Cranelift: check for volatile loads and stores late in alias analysis's classify to the merge queue.
:check: fitzgen merged PR #15029.
fitzgen removed PR #15029 Cranelift: check for volatile loads and stores late in alias analysis's classify from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC