diff options
author | Devang Patel <dpatel@apple.com> | 2007-03-09 21:19:53 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-03-09 21:19:53 +0000 |
commit | 4fe26582c09ec19873753cb4e9bb2ac3cdace88a (patch) | |
tree | 47aecb72855b3b21fd0766b40bd7b62e60f0447b /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | afc378201d0502a008332d2e009c81fc2692987e (diff) | |
download | llvm-4fe26582c09ec19873753cb4e9bb2ac3cdace88a.tar.gz llvm-4fe26582c09ec19873753cb4e9bb2ac3cdace88a.tar.bz2 llvm-4fe26582c09ec19873753cb4e9bb2ac3cdace88a.tar.xz |
Increment iterator now because IVUseShouldUsePostIncValue may remove
User from the list of I users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35051 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-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 fcbf9e301c..ec3fed2f1b 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -400,10 +400,14 @@ bool LoopStrengthReduce::AddUsersIfInteresting(Instruction *I, Loop *L, SCEVHandle Stride = Start; if (!getSCEVStartAndStride(ISE, L, Start, Stride)) return false; // Non-reducible symbolic expression, bail out. - - for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;++UI){ + + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E;) { Instruction *User = cast<Instruction>(*UI); + // Increment iterator now because IVUseShouldUsePostIncValue may remove + // User from the list of I users. + ++UI; + // Do not infinitely recurse on PHI nodes. if (isa<PHINode>(User) && Processed.count(User)) continue; |