[llvm-commits] [PATCH] X86: Turn cmovs into branches when profitable.
chandlerc at google.com
Fri Apr 27 17:23:06 CDT 2012
On Fri, Apr 27, 2012 at 3:10 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>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
> ...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.
Agreed. However, the bias would be useful to reconstitute on any branches
formed to represent the select, so that the subsequent codegen passes can
make the appropriate decisions...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits