LTO ?

Hi folks,

I've got an idea for something I may be able to do as a Link-Time-Optimization pass,
but I can't seem to find how LTO gets used. My crude approach has been to compile
LLVM for debugging, and then run gdb on llvm-ld with -O5 and two .bc files, trying to
catch LTO in action. I've also scanned the compiled tools, and none of them appear
to use the symbol 'createLLVMOptimizer' (or anything with 'lto', etc). The document at
LLVM Link Time Optimization: Design and Implementation doesn't seem to be of much
help for getting started with this. How do I provoke LTO? Any suggestions?

Thanks,

Jeff

Jeff Inman -- jti@lanl.gov
Advanced Architectures for Computation
Los Alamos National Laboratory

You can use the opt tool to run passes explicitly. For IPO passes to have much effect, you need to run -internalize first.

--Owen

Hi folks,

I've got an idea for something I may be able to do as a Link-Time-
Optimization pass,
but I can't seem to find how LTO gets used. My crude approach has
been to compile
LLVM for debugging, and then run gdb on llvm-ld with -O5 and two .bc
files, trying to
catch LTO in action.

Then, you want to set up a break-point at tools/llvm-ld/Optimizer.cpp:109 Optimizer(Module *M)

I've also scanned the compiled tools, and none
of them appear
to use the symbol 'createLLVMOptimizer' (or anything with 'lto',
etc). The document at
LLVM Link Time Optimization: Design and Implementation doesn't
seem to be of much
help for getting started with this.

This document is intended for someone who wants to integrate LLVM optimizer in the system linker. If a system linker can optimizer LLVM bitcodes then that is one way to take advantage of LTO. Another approach is to use llvm-ld to join multiple .bc files together and optimize them using various interprocedural optimizations.