Make method private. Keep coding standard.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177348 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak 2013-03-18 23:31:30 +00:00
parent ee29c16890
commit 89c4dc6339

View File

@ -36,10 +36,6 @@ namespace {
// Possibly eliminate loop L if it is dead. // Possibly eliminate loop L if it is dead.
bool runOnLoop(Loop *L, LPPassManager &LPM); bool runOnLoop(Loop *L, LPPassManager &LPM);
bool IsLoopDead(Loop* L, SmallVector<BasicBlock*, 4>& exitingBlocks,
SmallVector<BasicBlock*, 4>& exitBlocks,
bool &Changed, BasicBlock *Preheader);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequired<DominatorTree>(); AU.addRequired<DominatorTree>();
AU.addRequired<LoopInfo>(); AU.addRequired<LoopInfo>();
@ -53,6 +49,12 @@ namespace {
AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LoopSimplifyID);
AU.addPreservedID(LCSSAID); AU.addPreservedID(LCSSAID);
} }
private:
bool isLoopDead(Loop *L, SmallVector<BasicBlock*, 4> &exitingBlocks,
SmallVector<BasicBlock*, 4> &exitBlocks,
bool &Changed, BasicBlock *Preheader);
}; };
} }
@ -71,10 +73,10 @@ Pass* llvm::createLoopDeletionPass() {
return new LoopDeletion(); return new LoopDeletion();
} }
/// IsLoopDead - Determined if a loop is dead. This assumes that we've already /// isLoopDead - Determined if a loop is dead. This assumes that we've already
/// checked for unique exit and exiting blocks, and that the code is in LCSSA /// checked for unique exit and exiting blocks, and that the code is in LCSSA
/// form. /// form.
bool LoopDeletion::IsLoopDead(Loop* L, bool LoopDeletion::isLoopDead(Loop *L,
SmallVector<BasicBlock*, 4> &exitingBlocks, SmallVector<BasicBlock*, 4> &exitingBlocks,
SmallVector<BasicBlock*, 4> &exitBlocks, SmallVector<BasicBlock*, 4> &exitBlocks,
bool &Changed, BasicBlock *Preheader) { bool &Changed, BasicBlock *Preheader) {
@ -93,7 +95,7 @@ bool LoopDeletion::IsLoopDead(Loop* L,
// block. If there are different incoming values for different exiting // block. If there are different incoming values for different exiting
// blocks, then it is impossible to statically determine which value should // blocks, then it is impossible to statically determine which value should
// be used. // be used.
for (unsigned i = 1; i < exitingBlocks.size(); ++i) { for (unsigned i = 1, e = exitingBlocks.size(); i < e; ++i) {
if (incoming != P->getIncomingValueForBlock(exitingBlocks[i])) if (incoming != P->getIncomingValueForBlock(exitingBlocks[i]))
return false; return false;
} }
@ -158,7 +160,7 @@ bool LoopDeletion::runOnLoop(Loop* L, LPPassManager& LPM) {
// Finally, we have to check that the loop really is dead. // Finally, we have to check that the loop really is dead.
bool Changed = false; bool Changed = false;
if (!IsLoopDead(L, exitingBlocks, exitBlocks, Changed, preheader)) if (!isLoopDead(L, exitingBlocks, exitBlocks, Changed, preheader))
return Changed; return Changed;
// Don't remove loops for which we can't solve the trip count. // Don't remove loops for which we can't solve the trip count.