Tanya Lattner | 3f7706b | 2004-11-07 06:08:43 +0000 | [diff] [blame] | 1 | ; 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 | |
Chris Lattner | 13d38cd | 2001-11-26 19:16:37 +0000 | [diff] [blame] | 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 | |