[llvm-commits] [llvm] r135296 - /llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp

Jakub Staszak jstaszak at apple.com
Fri Jul 15 13:51:06 PDT 2011


Author: kuba
Date: Fri Jul 15 15:51:06 2011
New Revision: 135296

URL: http://llvm.org/viewvc/llvm-project?rev=135296&view=rev
Log:
Fix pointer heuristic. Check whether predicator is ICMP_NE instead of if it is
not isEquality().

Modified:
    llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp

Modified: llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp?rev=135296&r1=135295&r2=135296&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/BranchProbabilityInfo.cpp Fri Jul 15 15:51:06 2011
@@ -168,7 +168,7 @@
 
   Value *Cond = BI->getCondition();
   ICmpInst *CI = dyn_cast<ICmpInst>(Cond);
-  if (!CI)
+  if (!CI || !CI->isEquality())
     return;
 
   Value *LHS = CI->getOperand(0);
@@ -185,7 +185,7 @@
   // p == 0   ->   isProb = false
   // p != q   ->   isProb = true
   // p == q   ->   isProb = false;
-  bool isProb = !CI->isEquality();
+  bool isProb = CI->getPredicate() == ICmpInst::ICMP_NE;
   if (!isProb)
     std::swap(Taken, NonTaken);
 





More information about the llvm-commits mailing list