brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · d6ed8c8 Raw
38 lines · plain
1; RUN: opt -verify-loop-info -passes=irce -irce-print-range-checks -irce-print-changed-loops %s -S 2>&1 | FileCheck %s2; RUN: opt -verify-loop-info -passes='require<branch-prob>,irce' -irce-print-range-checks -irce-print-changed-loops %s -S 2>&1 | FileCheck %s3 4; CHECK: irce: loop has 1 inductive range checks:5; CHECK-NEXT:InductiveRangeCheck:6; CHECK-NEXT:  Begin: %offset  Step: 1  End:   %len7; CHECK-NEXT:  CheckUse:   br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !1 Operand: 08; CHECK-NEXT: irce: in function incrementing: constrained Loop at depth 1 containing: %loop<header><exiting>,%in.bounds<latch><exiting>9 10define void @incrementing(ptr %arr, ptr %a_len_ptr, i32 %n, i32 %offset) {11 entry:12  %len = load i32, ptr %a_len_ptr, !range !013  %first.itr.check = icmp sgt i32 %n, 014  br i1 %first.itr.check, label %loop, label %exit15 16 loop:17  %idx = phi i32 [ 0, %entry ] , [ %idx.next, %in.bounds ]18  %idx.next = add i32 %idx, 119  %array.idx = add i32 %idx, %offset20  %abc = icmp slt i32 %array.idx, %len21  br i1 %abc, label %in.bounds, label %out.of.bounds, !prof !122 23 in.bounds:24  %addr = getelementptr i32, ptr %arr, i32 %array.idx25  store i32 0, ptr %addr26  %next = icmp slt i32 %idx.next, %n27  br i1 %next, label %loop, label %exit28 29 out.of.bounds:30  ret void31 32 exit:33  ret void34}35 36!0 = !{i32 0, i32 2147483647}37!1 = !{!"branch_weights", i32 64, i32 4}38