[llvm-commits] [PATCH] X86: Turn cmovs into branches when profitable.

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Apr 27 15:10:02 PDT 2012


On Apr 27, 2012, at 2:31 PM, Andrew Trick wrote:

> 
> On Apr 26, 2012, at 10:48 PM, Evan Cheng <evan.cheng at apple.com> wrote:
> 
>> That seems like a BranchProbabilityInfo deficiency. Andy, what do you think? Benjamin, can you point us to examples of long select chains? Are they in real world benchmarks?
> 
> 
> Rhetorical question: If we have profile data or simple static heuristics that suggest a biased branch, should we really have turned it into a select?
> Obvious answer: the front end doesn't want to know about condition probabilities.
> 
> ...but handling this in any branch profiler won't be clean.
> 
> We'll probably have to plop metadata on the select if we really care that much. When we convert back to control flow, it will be easy to move the metadata to the branch's MD_prof and update BranchProbability if needed. It doesn't seem too hard to add support to LowerExpectIntrinsic.

It is not obvious to me that there is a strong correlation between branch bias and branch predictability.

Branch predictors are much better than 'take the most probable direction'. A 50/50 branch can be perfectly predictable, and conversely a 10/90 branch can be very difficult to predict.

Using branch bias to estimate predictability only makes sense for strongly biased branches.

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120427/34996c5b/attachment.html>


More information about the llvm-commits mailing list