summaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-11-29 19:07:57 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-11-29 19:07:57 +0000
commit7d4253af167479759fa5a71b7607b40033b96492 (patch)
treeba939f9409dd2b628037a5153dadb39956def787 /lib/Analysis/ScalarEvolution.cpp
parentb36be80510b9b38a9341623db3a6a9a49f1764fe (diff)
downloadllvm-7d4253af167479759fa5a71b7607b40033b96492.tar.gz
llvm-7d4253af167479759fa5a71b7607b40033b96492.tar.bz2
llvm-7d4253af167479759fa5a71b7607b40033b96492.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 852eb2b13d..977f57ee79 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/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) {