summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-03-09 21:19:53 +0000
committerDevang Patel <dpatel@apple.com>2007-03-09 21:19:53 +0000
commit58818c530fe22c31e52556c0ac17a7d19626e245 (patch)
tree67ee1888c2c0339d407cbfe4c5816c5d1f5673d8 /llvm/lib/Transforms
parentad3618a33d9e28867188ca8d57e74b1354af53e1 (diff)
downloadbcm5719-llvm-58818c530fe22c31e52556c0ac17a7d19626e245.tar.gz
bcm5719-llvm-58818c530fe22c31e52556c0ac17a7d19626e245.zip
Increment iterator now because IVUseShouldUsePostIncValue may remove
User from the list of I users. llvm-svn: 35051
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index fcbf9e301cf..ec3fed2f1ba 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud