[llvm-commits] [llvm] r74395 - /llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
Dan Gohman
gohman at apple.com
Sat Jun 27 14:23:41 PDT 2009
Author: djg
Date: Sat Jun 27 16:23:40 2009
New Revision: 74395
URL: http://llvm.org/viewvc/llvm-project?rev=74395&view=rev
Log:
More minor code simplifications.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=74395&r1=74394&r2=74395&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Sat Jun 27 16:23:40 2009
@@ -352,10 +352,9 @@
// 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 @@
"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 @@
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());
More information about the llvm-commits
mailing list