diff options
author | Alon Zakai <azakai@google.com> | 2021-10-19 15:33:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 15:33:54 -0700 |
commit | 055ac806810c1355b2f9b807a7c51cd1bbfbf4ce (patch) | |
tree | 32340cea4e221ffc9ce6a8564ea7870eab409660 /test/binaryen.js/zero-filled-memory.js | |
parent | d09be7af5b00f5e739ed56077ac5fb6b8e4e2adf (diff) | |
download | binaryen-055ac806810c1355b2f9b807a7c51cd1bbfbf4ce.tar.gz binaryen-055ac806810c1355b2f9b807a7c51cd1bbfbf4ce.tar.bz2 binaryen-055ac806810c1355b2f9b807a7c51cd1bbfbf4ce.zip |
SimplifyGlobals: Detect trivial read-only-to-write functions (#4257)
We already detected code that looks like
if (foo == 0) {
foo = 1;
}
That "read only to write" pattern occurs also in functions, like this:
function bar() {
if (foo == 0) return;
foo = 1;
}
This PR detects that pattern. It moves code around to share almost
all the logic with the previous pattern (the git diff is not that useful
there, sadly, but looking at them side by side that should be
obvious).
This helps in j2cl on some common clinits, where the clinit function
ends up empty, which is exactly this pattern.
Diffstat (limited to 'test/binaryen.js/zero-filled-memory.js')
0 files changed, 0 insertions, 0 deletions