[llvm-commits] [PATCH] X86: Turn cmovs into branches when profitable.
Evan Cheng
evan.cheng at apple.com
Sun Apr 29 10:59:33 PDT 2012
On Apr 27, 2012, at 3:10 PM, Jakob Stoklund Olesen wrote:
>
> 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.
Right. That's why I suggested using something similar to if-converter's heuristics. It should be the same heuristics except for the opposite direction. If-converter is turning branchy code into predicated code, this pass is turning predicated code back into branchy code.
Evan
>
> /jakob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120429/592af0dd/attachment.html>
More information about the llvm-commits
mailing list