-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
At OpenBSD, for building lang/rust package, we switched from using standard LLVM version (3.9.1) to embedded LLVM version, in order to be able to update LLVM at 4.0.0.
The switch has a big performance impact: the build of rust passed from approx 2h (build with linking to external LLVM) to 12h (with 2h for building LLVM itself). And every program built with rustc had a similar performance impact (build time for cargo raise by a factor of 8).
I passed lot of time to found the issue (comparing source tree between stock LLVM-3.9.1 and src/llvm
, reviewing cmake options and finally comparing compiler command-line). It appeared that LLVM embedded version is build without optimization (no -O2
in CFLAGS
).
As workaround, I removed the filter out of -O
options from bootstrap code, and the build time come back to something more coherent: only 4h (with 2h for LLVM itself - so it is similar to what we had before).
In order to check the LLVM comand-line at compilation, I also added cfg.define("CMAKE_VERBOSE_MAKEFILE", "ON");
to src/bootstrap/native.rs
.
I dunno if the issue is only on OpenBSD or could be found on other platform. Maybe Linux adds some optimization by default on the compiler ? or it is LLVM that doesn't enable same optimizations set depending the platform ?