Fix pointer heuristic. Check whether predicator is ICMP_NE instead of if it is

not isEquality().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135296 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak 2011-07-15 20:51:06 +00:00
parent bc7d598cc1
commit d7932ca962

View File

@ -168,7 +168,7 @@ void BranchProbabilityAnalysis::calcPointerHeuristics(BasicBlock *BB) {
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 @@ void BranchProbabilityAnalysis::calcPointerHeuristics(BasicBlock *BB) {
// 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);