diff options
author | Alon Zakai <azakai@google.com> | 2019-12-03 11:26:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-03 11:26:06 -0800 |
commit | 31eac76abfc24afe2217fae0f20ebee2a5871e5c (patch) | |
tree | 7bd752f968023e2a6a96045967bf9c15cc755227 | |
parent | 0c2b5b417fdf897037d1e91e170601a67c80dab8 (diff) | |
download | binaryen-31eac76abfc24afe2217fae0f20ebee2a5871e5c.tar.gz binaryen-31eac76abfc24afe2217fae0f20ebee2a5871e5c.tar.bz2 binaryen-31eac76abfc24afe2217fae0f20ebee2a5871e5c.zip |
Apply old fastcomp flags, reverting a large 30% size regression (#2483)
And use LTO in upstream opt builds, which improves code size by >20%.
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index dd5a1f692..96d23eb59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,6 +180,17 @@ IF (EMSCRIPTEN) ADD_LINK_FLAG("-s DISABLE_EXCEPTION_CATCHING=0") # make the tools immediately usable on Node.js ADD_LINK_FLAG("-s NODERAWFS") + # this can be moved into the fastcomp section once upstream ignores this flag, + # https://github.com/emscripten-core/emscripten/pull/9897 + ADD_COMPILE_FLAG("-Wno-almost-asm") + # check for fastcomp by the clang version, which is stuck in fastcomp way + # back in the past + IF (${CMAKE_CXX_COMPILER_VERSION} STREQUAL "6.0.1") + ADD_LINK_FLAG("-s ELIMINATE_DUPLICATE_FUNCTIONS=1") + ELSE() + # in opt builds, LTO helps so much (>20%) it's worth slow compile times + ADD_NONDEBUG_COMPILE_FLAG("-s WASM_OBJECT_FILES=0") + ENDIF() ENDIF() # clang doesn't print colored diagnostics when invoked from Ninja @@ -339,6 +350,7 @@ IF (EMSCRIPTEN) TARGET_LINK_LIBRARIES(binaryen_js "-s EXPORT_NAME=Binaryen") TARGET_LINK_LIBRARIES(binaryen_js "--post-js ${CMAKE_CURRENT_SOURCE_DIR}/src/js/binaryen.js-post.js") TARGET_LINK_LIBRARIES(binaryen_js optimized "--closure 1") + TARGET_LINK_LIBRARIES(binaryen_js optimized "--llvm-lto 1") TARGET_LINK_LIBRARIES(binaryen_js debug "--profiling") SET_PROPERTY(TARGET binaryen_js PROPERTY CXX_STANDARD 14) SET_PROPERTY(TARGET binaryen_js PROPERTY CXX_STANDARD_REQUIRED ON) |