diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-06-08 17:51:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-08 17:51:22 -0700 |
commit | c7b78eadec731675ef3274126d0d19df5e4263c5 (patch) | |
tree | 2f373af3e8b8bad6adc3af9e52c3e5ca4a95ff37 /src/wasm/wasm-binary.cpp | |
parent | e3d201158d9136d6ffb655f70904dae5f9079317 (diff) | |
download | binaryen-c7b78eadec731675ef3274126d0d19df5e4263c5.tar.gz binaryen-c7b78eadec731675ef3274126d0d19df5e4263c5.tar.bz2 binaryen-c7b78eadec731675ef3274126d0d19df5e4263c5.zip |
-O4: When -O3 isn't enough (#1596)
This defines a new -O4 optimization mode, as flatten + flat-only opts (currently local-cse) + -O3.
In practice, flattening is not needed for LLVM output, which is pretty flat already (no block or if values, etc., even if it does use tees and does nest expressions; and LLVM has already done gvn etc. anyhow). In general, though, wasm generated by a non-LLVM compiler may naturally be nested because wasm allows that. See for example #1593 where an AssemblyScript testcase requires flattening to be fully optimized. So -O4 can help there.
-O4 takes 3x longer to run than -O3 in my testing, basically because flat IR is much bigger. But when it's useful it may be worth it. It does handle that AssemblyScript testcase and others like it. There's not much big real-world code that isn't LLVM yet, but running the fuzzer - which happily creates nested stuff all the time - I see -O4 consistently shrink the size by around 20% over -O3.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
0 files changed, 0 insertions, 0 deletions