diff options
author | Chris Lattner <sabre@nondot.org> | 2005-02-26 18:50:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-02-26 18:50:19 +0000 |
commit | 7ffc07dcf7a0afc5e70e799f26de75750a8008d5 (patch) | |
tree | c6821944c54081dc682c0a2e04bfb695c3dcc9e8 /lib/Analysis/ScalarEvolution.cpp | |
parent | fe75292503c2f3ef66d395fc3fbeb503eefed577 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index a47bf0d348..d2331ba338 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -625,6 +625,7 @@ SCEVHandle SCEVAddExpr::get(std::vector<SCEVHandle> &Ops) { 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 @@ SCEVHandle SCEVMulExpr::get(std::vector<SCEVHandle> &Ops) { 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 |