aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-02-14 23:06:02 +0000
committerChris Lattner <sabre@nondot.org>2006-02-14 23:06:02 +0000
commit0ab9f966de73911930b47ce09f2a691bc687ed32 (patch)
tree342980b5e14b95b41041aadea7b612886ae3e323 /lib/Transforms/Utils
parentdea7245997f37972ed2f94d4ca1ec50c5af5000a (diff)
downloadexternal_llvm-0ab9f966de73911930b47ce09f2a691bc687ed32.zip
external_llvm-0ab9f966de73911930b47ce09f2a691bc687ed32.tar.gz
external_llvm-0ab9f966de73911930b47ce09f2a691bc687ed32.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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/LoopSimplify.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index a41692b..3188f12 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/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;
}