Increment iterator now because IVUseShouldUsePostIncValue may remove

User from the list of I users.

llvm-svn: 35051
This commit is contained in:
Devang Patel 2007-03-09 21:19:53 +00:00
parent ad3618a33d
commit 58818c530f
1 changed files with 6 additions and 2 deletions

View File

@ -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;