mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-08 04:51:23 +00:00
65f2077c62
It also makes it more aggressive in querying range information by adding a call to isKnownPredicateWithRanges to isLoopBackedgeGuardedByCond and isLoopEntryGuardedByCond. phabricator: http://reviews.llvm.org/D5638 Reviewed by: atrick, hfinkel git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219532 91177308-0d34-0410-b5e6-96231b3b80d8
38 lines
971 B
LLVM
38 lines
971 B
LLVM
; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s
|
|
|
|
define i32 @slt_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) {
|
|
; CHECK-LABEL: slt_trip_count_with_range
|
|
entry:
|
|
%limit = load i32* %ptr0, !range !0
|
|
br label %loop
|
|
|
|
loop:
|
|
; CHECK: Loop %loop: max backedge-taken count is 98
|
|
%index = phi i32 [ 0, %entry ], [ %index.inc, %loop ]
|
|
%index.inc = add i32 %index, 1
|
|
%continue = icmp slt i32 %index.inc, %limit
|
|
br i1 %continue, label %loop, label %loop.exit
|
|
|
|
loop.exit:
|
|
ret i32 0
|
|
}
|
|
|
|
define i32 @ult_trip_count_with_range(i32 *%ptr0, i32 *%ptr1) {
|
|
; CHECK-LABEL: ult_trip_count_with_range
|
|
entry:
|
|
%limit = load i32* %ptr0, !range !0
|
|
br label %loop
|
|
|
|
loop:
|
|
; CHECK: Loop %loop: max backedge-taken count is 98
|
|
%index = phi i32 [ 0, %entry ], [ %index.inc, %loop ]
|
|
%index.inc = add i32 %index, 1
|
|
%continue = icmp ult i32 %index.inc, %limit
|
|
br i1 %continue, label %loop, label %loop.exit
|
|
|
|
loop.exit:
|
|
ret i32 0
|
|
}
|
|
|
|
!0 = metadata !{i32 1, i32 100}
|