summaryrefslogtreecommitdiff
path: root/src/tools/wasm-split/instrumenter.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-09-03 11:00:10 -0700
committerGitHub <noreply@github.com>2021-09-03 11:00:10 -0700
commit99ccc313b2c1d91bbfcee48fe99d70a2867befbc (patch)
treeb52a466a3d9eaf8685edfc52e393230c099cf8de /src/tools/wasm-split/instrumenter.cpp
parent548d1971c3c844e8dab8c0da4e97aa5c339937df (diff)
downloadbinaryen-99ccc313b2c1d91bbfcee48fe99d70a2867befbc.tar.gz
binaryen-99ccc313b2c1d91bbfcee48fe99d70a2867befbc.tar.bz2
binaryen-99ccc313b2c1d91bbfcee48fe99d70a2867befbc.zip
Optimize away dominated calls to functions that run only once (#4111)
Some functions run only once with this pattern: function foo() { if (foo$ran) return; foo$ran = 1; ... } If that global is not ever set to 0, then the function's payload (after the initial if and return) will never execute more than once. That means we can optimize away dominated calls: foo(); foo(); // we can remove this To do this, we find which globals are "once", which means they can fit in that pattern, as they are never set to 0. If a function looks like the above pattern, and it's global is "once", then the function is "once" as well, and we can perform this optimization. This removes over 8% of static calls in j2cl.
Diffstat (limited to 'src/tools/wasm-split/instrumenter.cpp')
0 files changed, 0 insertions, 0 deletions