diff options
author | Alon Zakai <azakai@google.com> | 2021-09-23 18:51:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-23 18:51:07 -0700 |
commit | 75e4e53292a5c6bf9736b0483de96667ba92774f (patch) | |
tree | f7019cdb69e63d9c384eb0f084e30cb2ab5ddf89 /src/tools/wasm-split/split-options.cpp | |
parent | 662f31c721ede0c3c2f5a455e711f4467225a475 (diff) | |
download | binaryen-75e4e53292a5c6bf9736b0483de96667ba92774f.tar.gz binaryen-75e4e53292a5c6bf9736b0483de96667ba92774f.tar.bz2 binaryen-75e4e53292a5c6bf9736b0483de96667ba92774f.zip |
Precompute: Only run a single LocalGraph iteration (#4184)
Precompute has a mode in which it propagates results from local.sets to
local.gets. That constructs a LocalGraph which is a non-trivial amount of
work. We used to run multiple iterations of this, but investigation shows that
such opportunities are extremely rare, as doing just a single propagation
iteration has no effect on the entire emscripten benchmark suite, nor on
j2cl output. Furthermore, we run this pass twice in the normal pipeline (once
early, once late) so even if there are such opportunities they may be
optimized already. And, --converge is a way to get additional iterations of
all passes if a user wants that, so it makes sense not to costly work for more
iterations automatically.
In effect, 99.99% of the time before this pass we would create the LocalGraph
twice: once the first time, then a second time only to see that we can't
actually optimize anything further. This PR makes us only create it once, which
makes precompute-propagate 10% faster on j2cl and even faster on other things
like poppler (33%) and LLVM (29%).
See the change in the test suite for an example of a case that does require
more than one iteration to be optimized. Note that even there, we only manage
to get benefit from a second iteration by doing something that overlaps with
another pass (optimizing out an if with condition 0), which shows even more
how unnecessary the extra work was.
See #4165
Diffstat (limited to 'src/tools/wasm-split/split-options.cpp')
0 files changed, 0 insertions, 0 deletions