My impression on thinLTO when I first heard of it, (EuroLLVM2015) was about achieving Cross Module Optimization (CMO) at the IR level.
Having parallel front-end compilation & initial optimization first, a thin-link of individual input units, more optimization by calling opt again on the combined IR, and finally the target codegen using llc.
A transformation similar to the following:
Input File 1: Clang+opt (with thinLTO)
Input File 2: Clang+opt (with thinLTO) — llvm-link ---- opt (for CMO) — llc for target codegen.
Input File n: Clang+opt (with thinLTO)
But from the presentation on LLVM Developers’ Meeting 2016, I believe thinLTO is more than that. The full advantage of this optimization should require a significant changes in the backend as well (I suppose).
Before I post my question, kudos to the entire team behind thinLTO optimization - Teresa Johnson, Mehdi Amni, Xinliang David Li, other developers and test engineers across the globe.
I am working on the compiler for a target wherein the code size improvement is a critical factor. We are still using LLVM 3.5 code base. We assume, by moving to LLVM4.0.0 (with thinLTO and other recent target independent optimizations) we would be able to improve the codegen to a considerable number.
With thinLTO in LLVM4.0.0 compiler, when we build an application with multiple compilation units, is it possible to achieve any benefit purely with LLVM IR passes (without really involving the compiler backend)?
If yes, can anyone provide me the information about the command-line options and the sequence to call the llvm components (clang, opt, etc.) to achieve it.
I truly value any input in this regard.