aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-31 22:50:31 +0000
committerDan Gohman <gohman@apple.com>2010-08-31 22:50:31 +0000
commit90b5f25e8d3db3a05a6cedfb70ad59e7db884f29 (patch)
treec388715814ddf3e444cd0bd44a84056b0eb6ff31 /lib/Analysis
parent43a6c5e2fccadb299c35cb3147d112f706922acd (diff)
downloadexternal_llvm-90b5f25e8d3db3a05a6cedfb70ad59e7db884f29.zip
external_llvm-90b5f25e8d3db3a05a6cedfb70ad59e7db884f29.tar.gz
external_llvm-90b5f25e8d3db3a05a6cedfb70ad59e7db884f29.tar.bz2
Revert r110916. This patch is buggy because the code inside the
inner loop doesn't update all the variables in the outer loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112665 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 863f8a6..af5d981 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/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);
}
}