diff options
Diffstat (limited to 'lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r-- | lib/Transforms/Utils/LCSSA.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp index 546f4b160a..5959324da6 100644 --- a/lib/Transforms/Utils/LCSSA.cpp +++ b/lib/Transforms/Utils/LCSSA.cpp @@ -226,6 +226,19 @@ bool llvm::formLCSSA(Loop &L, DominatorTree &DT, ScalarEvolution *SE) { return Changed; } +/// Process a loop nest depth first. +bool llvm::formLCSSARecursively(Loop &L, DominatorTree &DT, + ScalarEvolution *SE) { + bool Changed = false; + + // Recurse depth-first through inner loops. + for (Loop::iterator LI = L.begin(), LE = L.end(); LI != LE; ++LI) + Changed |= formLCSSARecursively(**LI, DT, SE); + + Changed |= formLCSSA(L, DT, SE); + return Changed; +} + namespace { struct LCSSA : public FunctionPass { static char ID; // Pass identification, replacement for typeid @@ -278,20 +291,8 @@ bool LCSSA::runOnFunction(Function &F) { // Simplify each loop nest in the function. for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) - Changed |= processLoop(**I); - - return Changed; -} - -/// Process a loop nest depth first. -bool LCSSA::processLoop(Loop &L) { - bool Changed = false; - - // Recurse depth-first through inner loops. - for (Loop::iterator LI = L.begin(), LE = L.end(); LI != LE; ++LI) - Changed |= processLoop(**LI); + Changed |= formLCSSARecursively(**I, *DT, SE); - Changed |= formLCSSA(L, *DT, SE); return Changed; } |