Dan Gohman | f9dd170 | 2007-08-15 13:36:28 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | grep phi | count 1 |
Chris Lattner | ac86efb | 2005-08-08 06:23:47 +0000 | [diff] [blame] | 2 | |
| 3 | ; This testcase should have ONE stride 18 indvar, the other use should have a |
| 4 | ; loop invariant value (B) added to it inside of the loop, instead of having |
| 5 | ; a whole indvar based on B for it. |
| 6 | |
Chris Lattner | ac86efb | 2005-08-08 06:23:47 +0000 | [diff] [blame] | 7 | declare bool %cond(uint) |
| 8 | |
| 9 | void %test(uint %B) { |
| 10 | br label %Loop |
| 11 | Loop: |
| 12 | %IV = phi uint [0, %0], [%IVn, %Loop] |
| 13 | |
| 14 | %C = mul uint %IV, 18 |
| 15 | %D = mul uint %IV, 18 |
| 16 | %E = add uint %D, %B |
| 17 | |
| 18 | %cnd = call bool %cond(uint %E) |
| 19 | call bool %cond(uint %C) |
| 20 | %IVn = add uint %IV, 1 |
| 21 | br bool %cnd, label %Loop, label %Out |
| 22 | Out: |
| 23 | ret void |
| 24 | } |