aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r--lib/Analysis/LoopInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index a361e629e1..035f92c33c 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/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.