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
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index afc1e5c..5cbb5fa 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2902,10 +2902,8 @@
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 @@
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)