diff options
author | Chris Lattner <sabre@nondot.org> | 2003-02-27 21:51:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-02-27 21:51:38 +0000 |
commit | 4f3b1d18083ac33d6d67566c6496279369cfcab2 (patch) | |
tree | 761f4b2e711f60a30a41b5558c91b786c7fa4ff7 /llvm/lib/Analysis/LoopInfo.cpp | |
parent | 4e2fbfb4c3051574f360bf5258a0c1d4d4794b5c (diff) | |
download | bcm5719-llvm-4f3b1d18083ac33d6d67566c6496279369cfcab2.tar.gz bcm5719-llvm-4f3b1d18083ac33d6d67566c6496279369cfcab2.zip |
Fix bug: LICM/2003-02-27-PreheaderProblem.ll
There may be a single outside predecessor and
still need a new loop-preheader if the predecessor has multiple
successors.
llvm-svn: 5656
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index a361e629e1a..035f92c33c3 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -200,6 +200,13 @@ BasicBlock *Loop::getLoopPreheader() const { return 0; // Multiple predecessors outside the loop Out = *PI; } + + // Make sure there is only one exit out of the preheader... + succ_iterator SI = succ_begin(Out); + ++SI; + if (SI != succ_end(Out)) + return 0; // Multiple exits from the block, must not be a preheader. + // If there is exactly one preheader, return it. If there was zero, then Out // is still null. |