diff options
author | Dan Gohman <gohman@apple.com> | 2009-06-27 21:23:40 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-06-27 21:23:40 +0000 |
commit | cfb32203bceb0638db976fea5ce906b2a1010bac (patch) | |
tree | 041b60e060f39f61532eea9fda220008effa6343 /lib/Transforms/Scalar/LoopRotation.cpp | |
parent | 9d59d9f8495b0361c9ffd1dc82888d8e7ba5070e (diff) |
More minor code simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopRotation.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopRotation.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 7a24b35a40..1f7892ad10 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -352,10 +352,9 @@ bool LoopRotate::rotateLoop(Loop *Lp, LPPassManager &LPM) { // Removing incoming branch from loop preheader to original header. // Now original header is inside the loop. - for (BasicBlock::iterator I = OrigHeader->begin(), E = OrigHeader->end(); - I != E; ++I) - if (PHINode *PN = dyn_cast<PHINode>(I)) - PN->removeIncomingValue(OrigPreHeader); + for (BasicBlock::iterator I = OrigHeader->begin(); + (PN = dyn_cast<PHINode>(I)); ++I) + PN->removeIncomingValue(OrigPreHeader); // Make NewHeader as the new header for the loop. L->moveToHeader(NewHeader); @@ -452,13 +451,10 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) { "Unexpected original pre-header terminator"); OrigPH_BI->setSuccessor(1, NewPreHeader); } - - for (BasicBlock::iterator I = NewHeader->begin(), E = NewHeader->end(); - I != E; ++I) { - PHINode *PN = dyn_cast<PHINode>(I); - if (!PN) - break; + PHINode *PN; + for (BasicBlock::iterator I = NewHeader->begin(); + (PN = dyn_cast<PHINode>(I)); ++I) { int index = PN->getBasicBlockIndex(OrigPreHeader); assert(index != -1 && "Expected incoming value from Original PreHeader"); PN->setIncomingBlock(index, NewPreHeader); @@ -545,11 +541,10 @@ void LoopRotate::preserveCanonicalLoopForm(LPPassManager &LPM) { BasicBlock *NExit = SplitEdge(L->getLoopLatch(), Exit, this); // Preserve LCSSA. - BasicBlock::iterator I = Exit->begin(), E = Exit->end(); - PHINode *PN = NULL; - for (; (PN = dyn_cast<PHINode>(I)); ++I) { + for (BasicBlock::iterator I = Exit->begin(); + (PN = dyn_cast<PHINode>(I)); ++I) { unsigned N = PN->getNumIncomingValues(); - for (unsigned index = 0; index < N; ++index) + for (unsigned index = 0; index != N; ++index) if (PN->getIncomingBlock(index) == NExit) { PHINode *NewPN = PHINode::Create(PN->getType(), PN->getName(), NExit->begin()); |