Use SimplifyICmpOperands in isKnownPredicate too.
authorDan Gohman <gohman@apple.com>
Sat, 24 Apr 2010 01:38:36 +0000 (01:38 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 24 Apr 2010 01:38:36 +0000 (01:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102233 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 0157238de1c173b085dec7874e0fc8b248ac23b9..d62eef7a81a5b1c20e6bb619bd839968b9b41d5f 100644 (file)
@@ -4939,6 +4939,9 @@ bool ScalarEvolution::isKnownNonZero(const SCEV *S) {
 
 bool ScalarEvolution::isKnownPredicate(ICmpInst::Predicate Pred,
                                        const SCEV *LHS, const SCEV *RHS) {
+  // Canonicalize the inputs first.
+  (void)SimplifyICmpOperands(Pred, LHS, RHS);
+
   // If LHS or RHS is an addrec, check to see if the condition is true in
   // every iteration of the loop.
   if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(LHS))