summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-02-26 18:50:19 +0000
committerChris Lattner <sabre@nondot.org>2005-02-26 18:50:19 +0000
commitf05d2b31786d76a9776775f40c8b7833290bf7cd (patch)
tree2bb796a0f95cddc0779aa973db43ae3100c333f2 /llvm/lib/Analysis/ScalarEvolution.cpp
parent67bf757d0aeafd36851ec1537981f2911f750766 (diff)
downloadbcm5719-llvm-f05d2b31786d76a9776775f40c8b7833290bf7cd.tar.gz
bcm5719-llvm-f05d2b31786d76a9776775f40c8b7833290bf7cd.zip
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. llvm-svn: 20337
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index a47bf0d3485..d2331ba3386 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud