aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-26 18:40:02 +0000
committerChris Lattner <sabre@nondot.org>2005-02-26 18:40:02 +0000
commit803513b364e27d303285d396fd8ee5b32149962a (patch)
treea2f4cb65d72ecf90fccf21d1baddf302aae7e252
parentbe54dcc8a9d14592e324d6e6ae1322782e17f09f (diff)
downloadexternal_llvm-803513b364e27d303285d396fd8ee5b32149962a.zip
external_llvm-803513b364e27d303285d396fd8ee5b32149962a.tar.gz
external_llvm-803513b364e27d303285d396fd8ee5b32149962a.tar.bz2
Fix a case where we incorrectly returned hasComputableLoopEvolution for
a ternary commutative expr. Remove FIXME that does not need to be fixed (can't happen). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20335 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/ScalarEvolutionExpressions.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/Analysis/ScalarEvolutionExpressions.h b/include/llvm/Analysis/ScalarEvolutionExpressions.h
index 8f113a4..b632bc5 100644
--- a/include/llvm/Analysis/ScalarEvolutionExpressions.h
+++ b/include/llvm/Analysis/ScalarEvolutionExpressions.h
@@ -197,10 +197,18 @@ namespace llvm {
return true;
}
+ // hasComputableLoopEvolution - Commutative expressions have computable loop
+ // evolutions iff they have at least one operand that varies with the loop,
+ // but that all varying operands are computable.
virtual bool hasComputableLoopEvolution(const Loop *L) const {
+ bool HasVarying = false;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
- if (getOperand(i)->hasComputableLoopEvolution(L)) return true;
- return false;
+ if (!getOperand(i)->isLoopInvariant(L))
+ if (getOperand(i)->hasComputableLoopEvolution(L))
+ HasVarying = true;
+ else
+ return false;
+ return HasVarying;
}
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
@@ -382,8 +390,6 @@ namespace llvm {
virtual bool hasComputableLoopEvolution(const Loop *QL) const {
if (L == QL) return true;
- /// FIXME: What if the start or step value a recurrence for the specified
- /// loop?
return false;
}