diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-31 22:50:31 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-31 22:50:31 +0000 |
commit | aabfc5279022103fe89710f926235645ae1e1a3e (patch) | |
tree | dbe1972fbaa85b553d9c6a46d347ae310a120b01 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 6789f8b6aedf6d7a3b26807a9d37eaa4ad272070 (diff) | |
download | bcm5719-llvm-aabfc5279022103fe89710f926235645ae1e1a3e.tar.gz bcm5719-llvm-aabfc5279022103fe89710f926235645ae1e1a3e.zip |
Revert r110916. This patch is buggy because the code inside the
inner loop doesn't update all the variables in the outer loop.
llvm-svn: 112665
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 863f8a65409..af5d981d9aa 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -1589,7 +1589,6 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, } // Check this multiply against other multiplies being added together. - bool AnyFold = false; for (unsigned OtherMulIdx = Idx+1; OtherMulIdx < Ops.size() && isa<SCEVMulExpr>(Ops[OtherMulIdx]); ++OtherMulIdx) { @@ -1617,14 +1616,12 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops, const SCEV *InnerMulSum = getAddExpr(InnerMul1,InnerMul2); const SCEV *OuterMul = getMulExpr(MulOpSCEV, InnerMulSum); if (Ops.size() == 2) return OuterMul; - Ops[Idx] = OuterMul; - Ops.erase(Ops.begin()+OtherMulIdx); - OtherMulIdx = Idx; - AnyFold = true; + Ops.erase(Ops.begin()+Idx); + Ops.erase(Ops.begin()+OtherMulIdx-1); + Ops.push_back(OuterMul); + return getAddExpr(Ops); } } - if (AnyFold) - return getAddExpr(Ops); } } |