[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 00:53:09 PDT 2020


xbolva00 added inline comments.


================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:980
+    // X != C -> Likely
+    switch (CI->getPredicate()) {
+    case CmpInst::ICMP_EQ:
----------------
xbolva00 wrote:
> ebrevnov wrote:
> > Looks like we want to set "likely" for equal and "unlikely" not equal regardless of actual value of a constant, right? In that case I would suggest to just check that case before processing specific constant values. Moreover recently added code at line 882 should be checking exactly the same condition for not constant values, right?
> I got perf regression when I used same condition from line 882.
Looks like we want to set "likely" for equal and "unlikely" not equal regardless of actual value of a constant, right? In that case I would suggest to just check that case before processing specific constant values.


Probably we should leave special cases 0, 1, -1.

For example, X <= 0   ->  Unlikely, but X >= 0   ->  Likely.



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