Reid Spencer | 69ccadd | 2006-12-02 04:23:10 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -adce -simplifycfg | llvm-dis | not grep br |
Chris Lattner | 3d78b23 | 2004-04-13 19:43:33 +0000 | [diff] [blame] | 2 | |
| 3 | ; No matter how hard you try, sqrt(1.0) is always 1.0. This allows the |
| 4 | ; optimizer to delete this loop. |
| 5 | |
| 6 | declare double %sqrt(double) |
| 7 | |
| 8 | double %test(uint %param) { |
| 9 | entry: |
| 10 | br label %Loop |
| 11 | |
| 12 | Loop: |
| 13 | %I2 = phi uint [ 0, %entry ], [ %I3, %Loop ] |
| 14 | %V = phi double [ 1.0, %entry], [ %V2, %Loop ] |
| 15 | |
| 16 | %V2 = call double %sqrt(double %V) |
| 17 | |
| 18 | %I3 = add uint %I2, 1 |
| 19 | %tmp.7 = setne uint %I3, %param |
| 20 | br bool %tmp.7, label %Loop, label %Exit |
| 21 | |
| 22 | Exit: |
| 23 | ret double %V |
| 24 | } |