[LLVMdev] recreate optimized clang output

Devang Patel dpatel at apple.com
Thu Jan 27 12:45:58 PST 2011


On Jan 27, 2011, at 12:37 PM, Hendrix_ at gmx.net wrote:

> 
> On 27.01.2011, at 21:12, Devang Patel wrote:
> 
>> 
>> On Jan 27, 2011, at 12:02 PM, Hendrix_ at gmx.net wrote:
>> 
>>> OK, I am looking for "LTO"/global optimization. So the function definition will remain "somewhere else" (externally), and the optimizer will find in some other module to possibly inline it later on.
>>> 
>>> I am planning to concat all the *.ll (eg "link" the files) and pass them to the "global" optimizer, as "size" is a very important optimization criterium to me. After that, the back-end will be invoked.
>>> Is that a good approach?
>> 
>> How about just add -O4 on clang (or llvm-gcc) command line to get LTO optimizations ?
>> See	http://llvm.org/docs/LinkTimeOptimization.html
>> 	http://llvm.org/docs/GoldPlugin.html
>> 	On Mac OS X, it is a checkbox in Xcode.
>> -
>> Devang
> 
> My backend doesnt supply lto :( I am trying to emulate lto like this:

The backend (or code generator) does not do LTO in this case also.

> 
> clang *.c -S -emit-llvm
> cat *.ll > very_big.ll
> opt -O3 -extra-things...
> llc very_big.ll.optimized

Try replacing "cat *.ll > very_big.ll" with "llvm-ld *.ll -o big.bc". 'llvm-ld' is another llvm tool, just like 'opt'

-
Devang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110127/0240a177/attachment.html>


More information about the llvm-dev mailing list