Sanjoy Das | 1f05c51 | 2014-10-10 21:22:34 +0000 | [diff] [blame] | 1 | ; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s |
| 2 | |
| 3 | define i32 @slt_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) { |
| 4 | ; CHECK-LABEL: slt_trip_count_with_range |
| 5 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 6 | %limit = load i32, i32* %ptr0, !range !0 |
Sanjoy Das | 1f05c51 | 2014-10-10 21:22:34 +0000 | [diff] [blame] | 7 | br label %loop |
| 8 | |
| 9 | loop: |
| 10 | ; CHECK: Loop %loop: max backedge-taken count is 98 |
| 11 | %index = phi i32 [ 0, %entry ], [ %index.inc, %loop ] |
| 12 | %index.inc = add i32 %index, 1 |
| 13 | %continue = icmp slt i32 %index.inc, %limit |
| 14 | br i1 %continue, label %loop, label %loop.exit |
| 15 | |
| 16 | loop.exit: |
| 17 | ret i32 0 |
| 18 | } |
| 19 | |
| 20 | define i32 @ult_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) { |
| 21 | ; CHECK-LABEL: ult_trip_count_with_range |
| 22 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 23 | %limit = load i32, i32* %ptr0, !range !0 |
Sanjoy Das | 1f05c51 | 2014-10-10 21:22:34 +0000 | [diff] [blame] | 24 | br label %loop |
| 25 | |
| 26 | loop: |
| 27 | ; CHECK: Loop %loop: max backedge-taken count is 98 |
| 28 | %index = phi i32 [ 0, %entry ], [ %index.inc, %loop ] |
| 29 | %index.inc = add i32 %index, 1 |
| 30 | %continue = icmp ult i32 %index.inc, %limit |
| 31 | br i1 %continue, label %loop, label %loop.exit |
| 32 | |
| 33 | loop.exit: |
| 34 | ret i32 0 |
| 35 | } |
| 36 | |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 37 | !0 = !{i32 1, i32 100} |