[LLVMdev] dragonegg svn benchmarks

Duncan Sands baldrick at free.fr
Wed Oct 12 00:40:53 PDT 2011

Hi Chris,

>> PS: With -fplugin-arg-dragonegg-enable-gcc-optzns the LLVM optimizers are run at
>> the following levels:
>> Command line option      LLVM optimizers run at
>> -------------------      ----------------------
>>          -O1              tiny amount of optimization
>>      -O2 or -O3                      -O1
>>      -O4 or -O5                      -O2
>>      -O6 or better                   -O3
> Hi Duncan,
> Out of curiosity, why do you follow this approach?  People generally use -O2 or -O3.  I'd recommend switching dragonegg to line those up with whatever you want people to use.

note that this is done only when the GCC optimizers are run.  The basic
observation is that running the LLVM optimizers at -O3 after running the
GCC optimizers (at -O3) results in slower code!  I mean slower than what
you get by running the LLVM optimizers at -O1 or -O2.  I didn't find time
to analyse this curiosity yet.  It might simply be that the LLVM inlining
level is too high given that inlining has already been done by GCC.  Anyway,
I didn't want to run LLVM at -O3 because of this.  The next question was:
what is better: LLVM at -O1 or at -O2?  My first experiments showed that
code quality was essentially the same.  Since at -O1 you get a nice compile
time speedup, I settled on using -O1.  Also -O1 makes some sense if the GCC
optimizers did a good job and all that is needed is to clean up the mess that
converting to LLVM IR can produce.  However later experiments showed that -O2
does seem to consistently result in slightly better code, so I've been thinking
of using -O2 instead.  This is one reason I encouraged Jack to use -O4 in his
benchmarks (i.e. GCC at -O3, LLVM at -O2) - to see if they show the same thing.

Ciao, Duncan.

PS: Dragonegg is a nice platform for understanding what the GCC optimizers
do better than LLVM.  It's a pity no-one seems to have used it for this.

More information about the llvm-dev mailing list