From ba11a9892ce3e0ae0088c326b423857d1c338ccc Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 29 Nov 2012 19:07:57 +0000 Subject: Follow up to 168711: It's safe to base this analysis on the found compare, just return the value for the right predicate. Thanks to Andy for catching this. llvm-svn: 168921 --- llvm/lib/Analysis/ScalarEvolution.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp') diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 852eb2b13d9..977f57ee79c 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -6149,10 +6149,9 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, if (SimplifyICmpOperands(Pred, LHS, RHS)) if (LHS == RHS) return CmpInst::isTrueWhenEqual(Pred); - - // Canonicalize the found cond too. We can't conclude a result from the - // simplified values. - SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS); + if (SimplifyICmpOperands(FoundPred, FoundLHS, FoundRHS)) + if (FoundLHS == FoundRHS) + return CmpInst::isFalseWhenEqual(FoundPred); // Check to see if we can make the LHS or RHS match. if (LHS == FoundRHS || RHS == FoundLHS) { -- cgit v1.2.3