Bill Wendling | dc17270 | 2013-08-05 23:43:18 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -analyze -scalar-evolution -scalar-evolution-max-iterations=0 | FileCheck %s |
Nick Lewycky | 5246026 | 2007-07-16 02:08:00 +0000 | [diff] [blame] | 2 | ; PR1533 |
| 3 | |
| 4 | @array = weak global [101 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=1] |
| 5 | |
Bill Wendling | dc17270 | 2013-08-05 23:43:18 +0000 | [diff] [blame] | 6 | ; CHECK: Loop %bb: backedge-taken count is 100 |
| 7 | |
Nick Lewycky | 5246026 | 2007-07-16 02:08:00 +0000 | [diff] [blame] | 8 | define void @loop(i32 %x) { |
| 9 | entry: |
| 10 | br label %bb |
| 11 | |
| 12 | bb: ; preds = %bb, %entry |
| 13 | %i.01.0 = phi i32 [ 100, %entry ], [ %tmp4, %bb ] ; <i32> [#uses=2] |
| 14 | %tmp1 = getelementptr [101 x i32]* @array, i32 0, i32 %i.01.0 ; <i32*> [#uses=1] |
| 15 | store i32 %x, i32* %tmp1 |
| 16 | %tmp4 = add i32 %i.01.0, -1 ; <i32> [#uses=2] |
| 17 | %tmp7 = icmp sgt i32 %tmp4, -1 ; <i1> [#uses=1] |
| 18 | br i1 %tmp7, label %bb, label %return |
| 19 | |
| 20 | return: ; preds = %bb |
| 21 | ret void |
| 22 | } |