aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-22 23:28:56 +0000
committerDan Gohman <gohman@apple.com>2009-06-22 23:28:56 +0000
commit91380b7239a3d09236b6fab64ba31b7ce0e0cb13 (patch)
treee6c6f1c22a71280e8ee1360db8b2f9b01085ef66 /lib/Analysis/ScalarEvolution.cpp
parent5bafff36c798608a189c517d37527e4a38863071 (diff)
Fix a bug in the trip-count computation with And/Or. If either of the
sides is CouldNotCompute, the resulting exact count must be CouldNotCompute. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index afc1e5c704..5cbb5fac8a 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2902,10 +2902,8 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCond(const Loop *L,
if (L->contains(TBB)) {
// Both conditions must be true for the loop to continue executing.
// Choose the less conservative count.
- if (BTI0.Exact == CouldNotCompute)
- BECount = BTI1.Exact;
- else if (BTI1.Exact == CouldNotCompute)
- BECount = BTI0.Exact;
+ if (BTI0.Exact == CouldNotCompute || BTI1.Exact == CouldNotCompute)
+ BECount = CouldNotCompute;
else
BECount = getUMinFromMismatchedTypes(BTI0.Exact, BTI1.Exact);
if (BTI0.Max == CouldNotCompute)
@@ -2936,10 +2934,8 @@ ScalarEvolution::ComputeBackedgeTakenCountFromExitCond(const Loop *L,
if (L->contains(FBB)) {
// Both conditions must be false for the loop to continue executing.
// Choose the less conservative count.
- if (BTI0.Exact == CouldNotCompute)
- BECount = BTI1.Exact;
- else if (BTI1.Exact == CouldNotCompute)
- BECount = BTI0.Exact;
+ if (BTI0.Exact == CouldNotCompute || BTI1.Exact == CouldNotCompute)
+ BECount = CouldNotCompute;
else
BECount = getUMinFromMismatchedTypes(BTI0.Exact, BTI1.Exact);
if (BTI0.Max == CouldNotCompute)