[PATCH] D86017: [BPI] Improve static heuristics for integer comparisons with CST
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 01:52:40 PDT 2020
xbolva00 added inline comments.
================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:885
// Otherwise -> Likely
if (CI->isTrueWhenEqual())
std::swap(TakenProb, UntakenProb);
----------------
ebrevnov wrote:
> xbolva00 wrote:
> > ebrevnov wrote:
> > > Looks like I misread this code originally. I thought the intent was to set "likely" if equal and "unlikely" if not. But as I understand now isTrueWhenEqual does completely different thing. I would suggest reverting this ASAP and rework.
> > All perf inprovement is gone when only == is unlikely. So atleast the comment should be fixed.
> It should be not only == is unlikely, but != is likely as well. Doesn't this help?
> What exact condition you have for which you need to set probabilities?
>
if (CI->isTrueWhenEqual())
so in this case
X == Y / X >= Y / X <= Y -> Unlikely
Otherwise likely.
When I used
if (Pred == EQ) then unlikely else likely, I got perf problems. So I think that LT/GT are key predicates which helps us here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86017/new/
https://reviews.llvm.org/D86017
More information about the llvm-commits
mailing list