Sanjoy Das | 2143447 | 2016-08-14 01:04:46 +0000 | [diff] [blame] | 1 | ; RUN: opt -verify-loop-info -irce -irce-print-range-checks -irce-print-changed-loops %s -S 2>&1 | FileCheck %s |
Sanjoy Das | 1ac93a5 | 2015-03-17 01:40:24 +0000 | [diff] [blame] | 2 | |
| 3 | ; CHECK: irce: loop has 1 inductive range checks: |
| 4 | ; CHECK-NEXT:InductiveRangeCheck: |
| 5 | ; CHECK-NEXT: Kind: RANGE_CHECK_UPPER |
| 6 | ; CHECK-NEXT: Offset: %offset Scale: 1 Length: %len = load i32, i32* %a_len_ptr, !range !0 |
Sanjoy Das | aa83c47 | 2016-05-23 22:16:45 +0000 | [diff] [blame] | 7 | ; CHECK-NEXT: CheckUse: br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1 Operand: 0 |
Sanjoy Das | 1ac93a5 | 2015-03-17 01:40:24 +0000 | [diff] [blame] | 8 | ; CHECK-NEXT: irce: in function incrementing: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting> |
| 9 | |
| 10 | define void @incrementing(i32 *%arr, i32 *%a_len_ptr, i32 %n, i32 %offset) { |
| 11 | entry: |
| 12 | %len = load i32, i32* %a_len_ptr, !range !0 |
| 13 | %first.itr.check = icmp sgt i32 %n, 0 |
| 14 | br i1 %first.itr.check, label %loop, label %exit |
| 15 | |
| 16 | loop: |
| 17 | %idx = phi i32 [ 0, %entry ] , [ %idx.next, %in.bounds ] |
| 18 | %idx.next = add i32 %idx, 1 |
| 19 | %array.idx = add i32 %idx, %offset |
| 20 | %abc = icmp slt i32 %array.idx, %len |
| 21 | br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1 |
| 22 | |
| 23 | in.bounds: |
| 24 | %addr = getelementptr i32, i32* %arr, i32 %array.idx |
| 25 | store i32 0, i32* %addr |
| 26 | %next = icmp slt i32 %idx.next, %n |
| 27 | br i1 %next, label %loop, label %exit |
| 28 | |
| 29 | out.of.bounds: |
| 30 | ret void |
| 31 | |
| 32 | exit: |
| 33 | ret void |
| 34 | } |
| 35 | |
| 36 | !0 = !{i32 0, i32 2147483647} |
| 37 | !1 = !{!"branch_weights", i32 64, i32 4} |