fitzgen opened PR #15241 from fitzgen:do-not-hoist-out-of-cold-blocks to bytecodealliance:main:
It likely is moving the value's computation out of a rare cold path and into a less-rare, hotter path.
This improves the code generated for the
sync-adapter-lazy-lend-in-loop.watdisas test, but doesn't actually show a speed up to thecm-online-statsbenchmark that that disas test is a rough proxy for. Presumably because, even though the cold path is never taken in that benchmark and so hoisting causes instructions that would not previously have been run to be executed, they are executed only once in the loop pre-header so the total delta instructions for the whole benchmark run is a tiny handful.On the full Sightglass suite, this is a very small improvement to a number of benchmarks:
compilation :: instructions-retired :: Geomean (29 benchmarks) No difference in performance. ┌──────────────┬────────────┬──────────────────┐ │ Geomean │ Benchmarks │ Engine │ ├──────────────┼────────────┼──────────────────┤ │ 644549547.99 │ 29 │ main │ ├──────────────┼────────────┼──────────────────┤ │ 644770469.80 │ 29 │ no-cold-hoisting │ └──────────────┴────────────┴──────────────────┘ execution :: instructions-retired :: Geomean (29 benchmarks) No difference in performance. ┌─────────────┬────────────┬──────────────────┐ │ Geomean │ Benchmarks │ Engine │ ├─────────────┼────────────┼──────────────────┤ │ 98325409.81 │ 29 │ main │ ├─────────────┼────────────┼──────────────────┤ │ 98322733.49 │ 29 │ no-cold-hoisting │ └─────────────┴────────────┴──────────────────┘ compilation :: instructions-retired :: dotnet-raytracer no-cold-hoisting is 1.0008x to 1.0015x faster than main! (confidence = 99%, p < 0.0001) ┌────────────┬────────────┬───────────────┬───────────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├────────────┼────────────┼───────────────┼───────────────┼────────┼──────────────────┤ │ 6060638129 │ 6083681041 │ 6072086578.01 │ 6072038811.00 │ 0.123% │ main │ ├────────────┼────────────┼───────────────┼───────────────┼────────┼──────────────────┤ │ 6054210351 │ 6080042439 │ 6065325913.85 │ 6064617237.50 │ 0.126% │ no-cold-hoisting │ └────────────┴────────────┴───────────────┴───────────────┴────────┴──────────────────┘ compilation :: instructions-retired :: rust-wasmprinter no-cold-hoisting is 1.000x to 1.001x faster than main! (confidence = 99%, p < 0.0001) ┌────────────┬────────────┬───────────────┬───────────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├────────────┼────────────┼───────────────┼───────────────┼────────┼──────────────────┤ │ 2863739184 │ 2880188600 │ 2870945193.11 │ 2870710900.00 │ 0.203% │ main │ ├────────────┼────────────┼───────────────┼───────────────┼────────┼──────────────────┤ │ 2861707284 │ 2874868131 │ 2868539534.35 │ 2868453475.00 │ 0.134% │ no-cold-hoisting │ └────────────┴────────────┴───────────────┴───────────────┴────────┴──────────────────┘ execution :: instructions-retired :: dotnet-raytracer no-cold-hoisting is 1.000x to 1.001x faster than main! (confidence = 99%, p < 0.0001) ┌───────────┬───────────┬──────────────┬──────────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼──────────────────┤ │ 245188477 │ 245582770 │ 245340668.63 │ 245376582.00 │ 0.065% │ main │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼──────────────────┤ │ 244869931 │ 245494779 │ 245174548.01 │ 245218435.00 │ 0.107% │ no-cold-hoisting │ └───────────┴───────────┴──────────────┴──────────────┴────────┴──────────────────┘ compilation :: instructions-retired :: starlingmonkey-markdown no-cold-hoisting is 1.000x to 1.001x faster than main! (confidence = 99%, p < 0.0001) ┌─────────────┬─────────────┬────────────────┬────────────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├─────────────┼─────────────┼────────────────┼────────────────┼────────┼──────────────────┤ │ 64460783043 │ 64634135725 │ 64545661593.46 │ 64541305722.00 │ 0.072% │ main │ ├─────────────┼─────────────┼────────────────┼────────────────┼────────┼──────────────────┤ │ 64459823996 │ 64588789834 │ 64523591411.15 │ 64518257100.00 │ 0.063% │ no-cold-hoisting │ └─────────────┴─────────────┴────────────────┴────────────────┴────────┴──────────────────┘ compilation :: instructions-retired :: hoot-earley-boyer no-cold-hoisting is 1.000x to 1.001x faster than main! (confidence = 99%, p = 0.0087) ┌────────────┬────────────┬───────────────┬───────────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├────────────┼────────────┼───────────────┼───────────────┼────────┼──────────────────┤ │ 7437395280 │ 7464330890 │ 7446307914.02 │ 7445631319.00 │ 0.091% │ main │ ├────────────┼────────────┼───────────────┼───────────────┼────────┼──────────────────┤ │ 7433332940 │ 7457417184 │ 7444179818.62 │ 7443768354.00 │ 0.100% │ no-cold-hoisting │ └────────────┴────────────┴───────────────┴───────────────┴────────┴──────────────────┘ execution :: instructions-retired :: shootout-switch no-cold-hoisting is 1.0000x to 1.0002x faster than main! (confidence = 99%, p = 0.0003) ┌────────┬────────┬───────────┬───────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├────────┼────────┼───────────┼───────────┼────────┼──────────────────┤ │ 696422 │ 708944 │ 697135.66 │ 696807.00 │ 0.039% │ main │ ├────────┼────────┼───────────┼───────────┼────────┼──────────────────┤ │ 696393 │ 708891 │ 697041.75 │ 696694.00 │ 0.029% │ no-cold-hoisting │ └────────┴────────┴───────────┴───────────┴────────┴──────────────────┘ execution :: instructions-retired :: dart-deltablue no-cold-hoisting is 1.00001x to 1.00003x faster than main! (confidence = 99%, p < 0.0001) ┌───────────┬───────────┬──────────────┬──────────────┬────────┬──────────────────┐ │ Min │ Max │ Mean │ Median │ Noise │ Engine │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼──────────────────┤ │ 459621184 │ 459824803 │ 459645395.82 │ 459630758.50 │ 0.006% │ main │ ├───────────┼───────────┼──────────────┼──────────────┼────────┼──────────────────┤ │ 459612486 │ 459839160 │ 459635628.36 │ 459620153.50 │ 0.005% │ no-cold-hoisting │ └───────────┴───────────┴──────────────┴──────────────┴────────┴──────────────────┘<!--
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
-->
fitzgen removed the review request for wasmtime-compiler-reviewers from PR #15241.
fitzgen requested alexcrichton for a review on PR #15241.
fitzgen requested wasmtime-core-reviewers for a review on PR #15241.
fitzgen requested wasmtime-compiler-reviewers for a review on PR #15241.
github-actions[bot] added the label cranelift on PR #15241.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton added PR #15241 Cranelift: do not hoist values out of cold blocks to the merge queue.
:check: alexcrichton merged PR #15241.
alexcrichton removed PR #15241 Cranelift: do not hoist values out of cold blocks from the merge queue.
Last updated: Nov 19 2026 at 20:05 UTC