summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-08-10 13:17:07 -0700
committerGitHub <noreply@github.com>2021-08-10 13:17:07 -0700
commit52a90ac33416322c1be103fba6ab32764d3d1c9e (patch)
tree5327e2f58886476b41b797db3d0c531d44a72c0b /src/wasm/wasm-binary.cpp
parent1545bbdaec52c8d81e0e8f74afebe73caadc6828 (diff)
downloadbinaryen-52a90ac33416322c1be103fba6ab32764d3d1c9e.tar.gz
binaryen-52a90ac33416322c1be103fba6ab32764d3d1c9e.tar.bz2
binaryen-52a90ac33416322c1be103fba6ab32764d3d1c9e.zip
SimplifyGlobals: Optimize away globals that are only read in order to write themselves (#4070)
If the only uses of a global are if (global == 0) { global = 1; } Then we do not need that global: while it has both reads and writes, the value in the global does not cause anything observable. It is read, but only to write to itself, and nothing else. This happens in real-world code from j2cl quite a lot, as they have an initialization pattern with globals, and in some cases we can optimize away the work done in the initialization, leaving only the globals in this pattern.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
0 files changed, 0 insertions, 0 deletions