diff options
author | Chris Lattner <sabre@nondot.org> | 2006-02-14 23:06:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-02-14 23:06:02 +0000 |
commit | 9c5693fb2adf270453f51df56ad262c810a48d75 (patch) | |
tree | dae28ffc15ff5d855b9ec84c7b2149a10c5aabcd /llvm/lib/Transforms/Utils/LoopSimplify.cpp | |
parent | 0451499b3c2bbe9a6145eacc2fe36b9aaa979cb7 (diff) | |
download | llvm-9c5693fb2adf270453f51df56ad262c810a48d75.zip llvm-9c5693fb2adf270453f51df56ad262c810a48d75.tar.gz llvm-9c5693fb2adf270453f51df56ad262c810a48d75.tar.bz2 |
Canonicalize inner loops before outer loops. Inner loop canonicalization
can provide work for the outer loop to canonicalize.
This fixes a case that breaks unswitching.
llvm-svn: 26189
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopSimplify.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index a41692b..3188f12 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -115,7 +115,11 @@ bool LoopSimplify::runOnFunction(Function &F) { /// bool LoopSimplify::ProcessLoop(Loop *L) { bool Changed = false; - + // Canonicalize inner loops before outer loops. Inner loop canonicalization + // can provide work for the outer loop to canonicalize. + for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) + Changed |= ProcessLoop(*I); + // Check to see that no blocks (other than the header) in the loop have // predecessors that are not in the loop. This is not valid for natural // loops, but can occur if the blocks are unreachable. Since they are @@ -205,9 +209,6 @@ bool LoopSimplify::ProcessLoop(Loop *L) { PN->eraseFromParent(); } - for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) - Changed |= ProcessLoop(*I); - return Changed; } |