diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-22 23:28:56 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-22 23:28:56 +0000 |
commit | 53efeb0e456c26a4907f27af344e0d6a8f60db72 (patch) | |
tree | 7ecd7bfe052fd6e5f0ac69bc1e8469a938d31421 /llvm/lib | |
parent | 2e076c4e02fb99c791277d55f1325a4fa31c9ef9 (diff) | |
download | bcm5719-llvm-53efeb0e456c26a4907f27af344e0d6a8f60db72.tar.gz bcm5719-llvm-53efeb0e456c26a4907f27af344e0d6a8f60db72.zip |
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.
llvm-svn: 73920
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index afc1e5c7046..5cbb5fac8ac 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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) |