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