Chris Lattner | 13d38cd | 2001-11-26 19:16:37 +0000 | [diff] [blame^] | 1 | implementation |
| 2 | |
| 3 | ;; This is an irreducible flow graph |
| 4 | |
| 5 | |
| 6 | void "irreducible"(bool %cond) |
| 7 | begin |
| 8 | br bool %cond, label %X, label %Y |
| 9 | |
| 10 | X: |
| 11 | br label %Y |
| 12 | Y: |
| 13 | br label %X |
| 14 | end |
| 15 | |
| 16 | ;; This is a pair of loops that share the same header |
| 17 | |
| 18 | void "sharedheader"(bool %cond) |
| 19 | begin |
| 20 | br label %A |
| 21 | A: |
| 22 | br bool %cond, label %X, label %Y |
| 23 | |
| 24 | X: |
| 25 | br label %A |
| 26 | Y: |
| 27 | br label %A |
| 28 | end |
| 29 | |
| 30 | ;; This is a simple nested loop |
| 31 | void "nested"(bool %cond1, bool %cond2, bool %cond3) |
| 32 | begin |
| 33 | br label %Loop1 |
| 34 | |
| 35 | Loop1: |
| 36 | br label %Loop2 |
| 37 | |
| 38 | Loop2: |
| 39 | br label %Loop3 |
| 40 | |
| 41 | Loop3: |
| 42 | br bool %cond3, label %Loop3, label %L3Exit |
| 43 | |
| 44 | L3Exit: |
| 45 | br bool %cond2, label %Loop2, label %L2Exit |
| 46 | |
| 47 | L2Exit: |
| 48 | br bool %cond1, label %Loop1, label %L1Exit |
| 49 | |
| 50 | L1Exit: |
| 51 | ret void |
| 52 | end |
| 53 | |