SCEV: Even if the latch terminator is foldable we can't deduce the result of an unrelated condition with it.

Fixes PR14432.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168711 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 5f60bd1..e3ec268 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -6149,9 +6149,10 @@
   if (SimplifyICmpOperands(Pred, LHS, RHS))
     if (LHS == RHS)
       return CmpInst::isTrueWhenEqual(Pred);
-  if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS))
-    if (FoundLHS == FoundRHS)
-      return CmpInst::isFalseWhenEqual(Pred);
+
+  // Canonicalize the found cond too.  We can't conclude a result from the
+  // simplified values.
+  SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS);
 
   // Check to see if we can make the LHS or RHS match.
   if (LHS == FoundRHS || RHS == FoundLHS) {