[LLVMdev] Enabling inlining

Jim Grosbach grosbach at apple.com
Wed Sep 22 14:37:38 PDT 2010


On Sep 22, 2010, at 2:24 PM, David Given wrote:

> On 22/09/10 18:07, Jim Grosbach wrote:
> [...]
>> Are you running 'opt' on your bitcode or otherwise manually running those passes?
> 
> Aha. After running opt I now have inlined (and much better) code.
> Previously I'd been using llc -O3 to do the optimisation.

Glad to hear you're having better results!

> What's the different between opt -O3 and llc -O3, then?

At the risk of a somewhat circular answer, they run different sets of passes. For best results, you want both.

More specifically, 'opt' runs target-independent IR optimizations and outputs back to LLVM IR, while llc runs (mostly) lower-level target-dependent optimizations, many of which operate at the machine instruction level rather than the IR level, and outputs the machine assembly code.

If you want more gory details of what's run in each, add "-debug-pass=Executions" to the command lines for them and they'll tell you which passes are being executed.

Regards,

-Jim



More information about the llvm-dev mailing list