[LLVMdev] Why code doesn't speed up much with optimization level increase?

Eli Friedman eli.friedman at gmail.com
Fri Jun 25 15:43:02 PDT 2010


On Fri, Jun 25, 2010 at 3:06 PM, Yuri <yuri at rawbw.com> wrote:
> I run large piece of code in JIT and it runs only marginallty faster
> with optimization levels 1,2,3. I think differences are within the
> margin or error.
>
> level     user time
> 0           17339ms
> 1           16913ms
> 2           16891ms
> 3           16898ms
>
> Level is set with builder->setOptLevel(olev);
> Compilation time is excluded by taking the only top-level function
> address before the run with getPointerToFunction. So I measure time
> without getPointerToFunction.
>
> Why optimization almost doesn't speed it up? What are the other than
> setOptLevel ways to control optimization?
>
> My mindset is defined by experience with gcc, when increasing inlining
> levels speeds the code up significantly. Does JIT inline at all?
> It's hard to believe that even only local (no inlining) optimization
> wouldn't bring timing down by at least 10%.
>
> i386 on i7
> r106715

Are you running IR-level optimizations?  There's only so much the code
generator can do with unoptimized IR...

-Eli




More information about the llvm-dev mailing list