Use isTrueWhenEqual and isFalseWhenEqual instead of assuming that
authorDan Gohman <gohman@apple.com>
Mon, 3 May 2010 18:00:24 +0000 (18:00 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 3 May 2010 18:00:24 +0000 (18:00 +0000)
SimplifyICmpOperands will simplify such cases to EQ or NE. This makes
the correcntess of the code independent on SimplifyICmpOperands doing
certain simplifications.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102927 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index f0cb7986bd8da3269f6451ffad57d1a886303854..30303cbbd1b7058d21d5e07b9ad5f6f8bd5706a2 100644 (file)
@@ -5260,10 +5260,10 @@ bool ScalarEvolution::isImpliedCond(Value *CondValue,
   // canonicalized the comparison.
   if (SimplifyICmpOperands(Pred, LHS, RHS))
     if (LHS == RHS)
-      return Pred == ICmpInst::ICMP_EQ;
+      return CmpInst::isTrueWhenEqual(Pred);
   if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS))
     if (FoundLHS == FoundRHS)
-      return Pred == ICmpInst::ICMP_NE;
+      return CmpInst::isFalseWhenEqual(Pred);
 
   // Check to see if we can make the LHS or RHS match.
   if (LHS == FoundRHS || RHS == FoundLHS) {