use continue to reduce indentation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2008-11-27 23:00:20 +00:00
parent 3481f24c06
commit a0d4486073

View File

@ -2076,25 +2076,26 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) {
// //
// FIXME: this needs to eliminate an induction variable even if it's being // FIXME: this needs to eliminate an induction variable even if it's being
// compared against some value to decide loop termination. // compared against some value to decide loop termination.
if (PN->hasOneUse()) { if (!PN->hasOneUse())
SmallPtrSet<PHINode *, 2> PHIs; continue;
for (Instruction *J = dyn_cast<Instruction>(*PN->use_begin());
J && J->hasOneUse() && !J->mayWriteToMemory(); SmallPtrSet<PHINode *, 4> PHIs;
J = dyn_cast<Instruction>(*J->use_begin())) { for (Instruction *J = dyn_cast<Instruction>(*PN->use_begin());
// If we find the original PHI, we've discovered a cycle. J && J->hasOneUse() && !J->mayWriteToMemory();
if (J == PN) { J = dyn_cast<Instruction>(*J->use_begin())) {
// Break the cycle and mark the PHI for deletion. // If we find the original PHI, we've discovered a cycle.
SE->deleteValueFromRecords(PN); if (J == PN) {
PN->replaceAllUsesWith(UndefValue::get(PN->getType())); // Break the cycle and mark the PHI for deletion.
DeadInsts.insert(PN); SE->deleteValueFromRecords(PN);
Changed = true; PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
break; DeadInsts.insert(PN);
} Changed = true;
// If we find a PHI more than once, we're on a cycle that break;
// won't prove fruitful.
if (isa<PHINode>(J) && !PHIs.insert(cast<PHINode>(J)))
break;
} }
// If we find a PHI more than once, we're on a cycle that
// won't prove fruitful.
if (isa<PHINode>(J) && !PHIs.insert(cast<PHINode>(J)))
break;
} }
} }
DeleteTriviallyDeadInstructions(DeadInsts); DeleteTriviallyDeadInstructions(DeadInsts);