From 7ffc07dcf7a0afc5e70e799f26de75750a8008d5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 26 Feb 2005 18:50:19 +0000 Subject: [PATCH] 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 --- lib/Analysis/ScalarEvolution.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index a47bf0d3485..d2331ba3386 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -625,6 +625,7 @@ SCEVHandle SCEVAddExpr::get(std::vector &Ops) { Ops[0] = SCEVConstant::get(CI); Ops.erase(Ops.begin()+1); // Erase the folded element if (Ops.size() == 1) return Ops[0]; + LHSC = cast(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 &Ops) { Ops[0] = SCEVConstant::get(CI); Ops.erase(Ops.begin()+1); // Erase the folded element if (Ops.size() == 1) return Ops[0]; + LHSC = cast(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