[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 26 10:40:15 PST 2005



Changes in directory llvm/include/llvm/Analysis:

ScalarEvolutionExpressions.h updated: 1.4 -> 1.5
---
Log message:

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).


---
Diffs of the changes:  (+10 -4)

 ScalarEvolutionExpressions.h |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h
diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.4 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.5
--- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.4	Sat Feb 12 22:34:51 2005
+++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h	Sat Feb 26 12:40:02 2005
@@ -197,10 +197,18 @@
       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 @@
 
     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;
     }
 






More information about the llvm-commits mailing list