blob: d8381b44f6d139ba543453709bee8450dc1894ff [file] [log] [blame]
Reid Spencerc0948362007-01-16 18:08:22 +00001; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
2; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3; RUN: diff %t1.ll %t2.ll
4
5implementation
6
7;; This is an irreducible flow graph
8
9
10define void "irreducible"(i1 %cond)
11begin
12 br i1 %cond, label %X, label %Y
13
14X:
15 br label %Y
16Y:
17 br label %X
18end
19
20;; This is a pair of loops that share the same header
21
22define void "sharedheader"(i1 %cond)
23begin
24 br label %A
25A:
26 br i1 %cond, label %X, label %Y
27
28X:
29 br label %A
30Y:
31 br label %A
32end
33
34;; This is a simple nested loop
35define void "nested"(i1 %cond1, i1 %cond2, i1 %cond3)
36begin
37 br label %Loop1
38
39Loop1:
40 br label %Loop2
41
42Loop2:
43 br label %Loop3
44
45Loop3:
46 br i1 %cond3, label %Loop3, label %L3Exit
47
48L3Exit:
49 br i1 %cond2, label %Loop2, label %L2Exit
50
51L2Exit:
52 br i1 %cond1, label %Loop1, label %L1Exit
53
54L1Exit:
55 ret void
56end
57