aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/RegionInfo/unreachable_bb.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/RegionInfo/unreachable_bb.ll')
-rw-r--r--test/Analysis/RegionInfo/unreachable_bb.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Analysis/RegionInfo/unreachable_bb.ll b/test/Analysis/RegionInfo/unreachable_bb.ll
new file mode 100644
index 0000000000..626ccbe304
--- /dev/null
+++ b/test/Analysis/RegionInfo/unreachable_bb.ll
@@ -0,0 +1,29 @@
+; RUN: opt -regions -analyze < %s | FileCheck %s
+
+; We should not crash if there are some bbs that are not reachable.
+define void @f() {
+entry:
+ br label %for.pre
+
+notintree: ; No predecessors!
+ br label %ret
+
+for.pre: ; preds = %entry
+ br label %for
+
+for: ; preds = %for.inc, %for.pre
+ %indvar = phi i64 [ 0, %for.pre ], [ %indvar.next, %for.inc ]
+ %exitcond = icmp ne i64 %indvar, 200
+ br i1 %exitcond, label %for.inc, label %ret
+
+for.inc: ; preds = %for
+ %indvar.next = add i64 %indvar, 1
+ br label %for
+
+ret: ; preds = %for, %notintree
+ ret void
+}
+
+; CHECK: [0] entry => <Function Return>
+; CHECK: [1] for => ret
+