aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-16 18:52:57 +0000
committerDan Gohman <gohman@apple.com>2008-09-16 18:52:57 +0000
commit70ff4cf1baf8cce04b38752ea485425782fb07b8 (patch)
tree8c577c8b629c215ae200ce2e0505518be0681a14 /lib/Analysis/ScalarEvolution.cpp
parent81b28ceab6bd0ed6a784b7dc952ddb0b03fc6de7 (diff)
Finally re-apply r46959. This is made feasible by the combination
of r56230, r56232, and r56246. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 4e85e90e9e..5125804469 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -1981,8 +1981,8 @@ SCEVHandle ScalarEvolutionsImpl::ComputeIterationCount(const Loop *L) {
// At this point, we would like to compute how many iterations of the
// loop the predicate will return true for these inputs.
- if (isa<SCEVConstant>(LHS) && !isa<SCEVConstant>(RHS)) {
- // If there is a constant, force it into the RHS.
+ if (LHS->isLoopInvariant(L) && !RHS->isLoopInvariant(L)) {
+ // If there is a loop-invariant, force it into the RHS.
std::swap(LHS, RHS);
Cond = ICmpInst::getSwappedPredicate(Cond);
}