[LLVMdev] Fwd: [llvm-commits] [llvm] r58225 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp

Dale Johannesen dalej at apple.com
Sun Oct 26 19:39:15 PDT 2008

Begin forwarded message:
> Increase default setting of tail-merge-threshold to
> 150, based on llvm-test measurements.
> static cl::opt<unsigned>
> TailMergeThreshold("tail-merge-threshold",
>           cl::desc("Max number of predecessors to consider tail  
> merging"),
> -          cl::init(100), cl::Hidden);
> +          cl::init(150), cl::Hidden);
> namespace {

(Background:  this threshold limits the number of predecessors a block  
can have when trying to tail merge, for reasons of compile speed.)
In case anyone cares what the measurements are:  The old threshold,  
100, was exceeded in 9 of the llvm tests.  With the higher threshold  
none of these takes more than 1.1 second extra to go through llc, and  
the pass removes from roughly 300 to 1000 extra instructions (this  
count includes labels).

I was hoping to get rid of this threshold entirely, after rewriting  
the algorithm a while back, but we aren't there yet.
It does seem to be true that higher compile times are associated with  
removing large numbers of instructions, rather than with simply  
comparing tails, so I think the rewrite (which addressed a poor  
algorithm for comparing large numbers of tails) was a success, but  
there might be something to do down in the machinery that removes  

The most extreme time is on 'kc', which takes a 25% hit when the  
threshold is disabled, but also removes 4200 extra instructions.   
Might be worth it -O3.

More information about the llvm-dev mailing list