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