diff options
author | Dale Johannesen <dalej@apple.com> | 2007-11-17 02:48:01 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2007-11-17 02:48:01 +0000 |
commit | d92fe9f029c77824141f189fe0615c0e516b5758 (patch) | |
tree | ff0627bf9bf1233b856ca1f16d7ff8dd871c162c | |
parent | 0690c13f4037bf11fd598213c594809402e31bc3 (diff) | |
download | external_llvm-d92fe9f029c77824141f189fe0615c0e516b5758.zip external_llvm-d92fe9f029c77824141f189fe0615c0e516b5758.tar.gz external_llvm-d92fe9f029c77824141f189fe0615c0e516b5758.tar.bz2 |
Remove indeterminism from a loop. We think this will
fix an occasional nonrepeatable bootstrap failure we've
been seeing on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44202 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index bd1d66a..d107799 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1028,8 +1028,12 @@ unsigned LoopStrengthReduce::CheckForIVReuse(bool HasBaseReg, const std::vector<BasedUser>& UsersToProcess) { if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride)) { int64_t SInt = SC->getValue()->getSExtValue(); - for (std::map<SCEVHandle, IVsOfOneStride>::iterator SI= IVsByStride.begin(), - SE = IVsByStride.end(); SI != SE; ++SI) { + for (unsigned NewStride = 0, e = StrideOrder.size(); NewStride != e; + ++NewStride) { + std::map<SCEVHandle, IVsOfOneStride>::iterator SI = + IVsByStride.find(StrideOrder[NewStride]); + if (SI == IVsByStride.end()) + continue; int64_t SSInt = cast<SCEVConstant>(SI->first)->getValue()->getSExtValue(); if (SI->first != Stride && (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)) |