[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 26 10:50:32 PST 2005



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.33 -> 1.34
---
Log message:

1 + 100 + 51 == 152, not 52.
If we fold three constants together (c1+c2+c3), make sure to keep
LHSC updated, instead of reusing (in this case), the 1 instead of the
partial sum.


---
Diffs of the changes:  (+2 -0)

 ScalarEvolution.cpp |    2 ++
 1 files changed, 2 insertions(+)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.33 llvm/lib/Analysis/ScalarEvolution.cpp:1.34
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.33	Thu Feb 17 10:54:16 2005
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Sat Feb 26 12:50:19 2005
@@ -625,6 +625,7 @@
         Ops[0] = SCEVConstant::get(CI);
         Ops.erase(Ops.begin()+1);  // Erase the folded element
         if (Ops.size() == 1) return Ops[0];
+        LHSC = cast<SCEVConstant>(Ops[0]);
       } else {
         // If we couldn't fold the expression, move to the next constant.  Note
         // that this is impossible to happen in practice because we always
@@ -861,6 +862,7 @@
         Ops[0] = SCEVConstant::get(CI);
         Ops.erase(Ops.begin()+1);  // Erase the folded element
         if (Ops.size() == 1) return Ops[0];
+        LHSC = cast<SCEVConstant>(Ops[0]);
       } else {
         // If we couldn't fold the expression, move to the next constant.  Note
         // that this is impossible to happen in practice because we always






More information about the llvm-commits mailing list