Define the ThinLTO Pipeline (experimental)
authorMehdi Amini <mehdi.amini@apple.com>
Tue, 16 Feb 2016 23:02:29 +0000 (23:02 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Tue, 16 Feb 2016 23:02:29 +0000 (23:02 +0000)
commit1db10ac6ce4deb09bf12a756965bee0b78f78292
tree60eac4993bb83bf070ecd39a32e4659bb8dc3eb9
parentec8bee1879ed8c0f206d2e60fd36fd274da43c26
Define the ThinLTO Pipeline (experimental)

Summary:
On the contrary to Full LTO, ThinLTO can afford to shift compile time
from the frontend to the linker: both phases are parallel (even if
it is not totally "free": projects like clang are reusing product
from the "compile phase" for multiple link, think about
libLLVMSupport reused for opt, llc, etc.).

This pipeline is based on the proposal in D13443 for full LTO. We
didn't move forward on this proposal because the LTO link was far too
long after that. We believe that we can afford it with ThinLTO.

The ThinLTO pipeline integrates in the regular O2/O3 flow:

 - The compile phase perform the inliner with a somehow lighter
   function simplification. (TODO: tune the inliner thresholds here)
   This is intendend to simplify the IR and get rid of obvious things
   like linkonce_odr that will be inlined.
 - The link phase will run the pipeline from the start, extended with
   some specific passes that leverage the augmented knowledge we have
   during LTO. Especially after the inliner is done, a sequence of
   globalDCE/globalOpt is performed, followed by another run of the
   "function simplification" passes. It is not clear if this part
   of the pipeline will stay as is, as the split model of ThinLTO
   does not allow the same benefit as FullLTO without added tricks.

The measurements on the public test suite as well as on our internal
suite show an overall net improvement. The binary size for the clang
executable is reduced by 5%. We're still tuning it with the bringup
of ThinLTO and it will evolve, but this should provide a good starting
point.

Reviewers: tejohnson

Differential Revision: http://reviews.llvm.org/D17115

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 261029
llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp