[WebAssembly] Use wasm-opt and LTO libraries when available.
authorDan Gohman <sunfish@mozilla.com>
Wed, 20 Nov 2019 23:25:43 +0000 (15:25 -0800)
committerDan Gohman <sunfish@mozilla.com>
Sat, 23 Nov 2019 06:16:28 +0000 (22:16 -0800)
commit812828984c10857a4cd260eb638c52a4411f9143
treeb88b3e18eb60ff280ba5f5f32c1fe5aba1102316
parent81b0a3284af1dcef26e56b0de9fd74002083c471
[WebAssembly] Use wasm-opt and LTO libraries when available.

When there's a wasm-opt in the PATH, run the it to optimize LLVM's
output. This fixes PR43796.

And, add an "llvm-lto" directory to the sysroot library search paths,
so that sysroots can provide LTO-enabled system libraries.

Differential Revision: https://reviews.llvm.org/D70500
clang/lib/Driver/ToolChains/WebAssembly.cpp
clang/test/Driver/wasm-toolchain-lto.c [new file with mode: 0644]