From a0d4486073f6303fbf33b50ac3fbae4601ea0229 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 27 Nov 2008 23:00:20 +0000 Subject: [PATCH] use continue to reduce indentation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60192 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 37 ++++++++++---------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 9052d6088e3..c2f3209f059 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2076,25 +2076,26 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) { // // FIXME: this needs to eliminate an induction variable even if it's being // compared against some value to decide loop termination. - if (PN->hasOneUse()) { - SmallPtrSet PHIs; - for (Instruction *J = dyn_cast(*PN->use_begin()); - J && J->hasOneUse() && !J->mayWriteToMemory(); - J = dyn_cast(*J->use_begin())) { - // If we find the original PHI, we've discovered a cycle. - if (J == PN) { - // Break the cycle and mark the PHI for deletion. - SE->deleteValueFromRecords(PN); - PN->replaceAllUsesWith(UndefValue::get(PN->getType())); - DeadInsts.insert(PN); - Changed = true; - break; - } - // If we find a PHI more than once, we're on a cycle that - // won't prove fruitful. - if (isa(J) && !PHIs.insert(cast(J))) - break; + if (!PN->hasOneUse()) + continue; + + SmallPtrSet PHIs; + for (Instruction *J = dyn_cast(*PN->use_begin()); + J && J->hasOneUse() && !J->mayWriteToMemory(); + J = dyn_cast(*J->use_begin())) { + // If we find the original PHI, we've discovered a cycle. + if (J == PN) { + // Break the cycle and mark the PHI for deletion. + SE->deleteValueFromRecords(PN); + PN->replaceAllUsesWith(UndefValue::get(PN->getType())); + DeadInsts.insert(PN); + Changed = true; + break; } + // If we find a PHI more than once, we're on a cycle that + // won't prove fruitful. + if (isa(J) && !PHIs.insert(cast(J))) + break; } } DeleteTriviallyDeadInstructions(DeadInsts); -- 2.34.1