1 ; RUN: opt < %s -analyze -enable-new-pm=0 -scalar-evolution -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 | FileCheck %s
2 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-iterations=0 -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 define void @max_backedge_taken_count_by_wrapping1_nsw_nuw(i8 %N, i8* %ptr) {
8 ; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping1_nsw_nuw
9 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%N /u 4)
10 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
11 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 4)
17 %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]
18 %gep = getelementptr i8, i8* %ptr, i8 %iv
19 store i8 %iv, i8* %gep
20 %iv.next = add nuw nsw i8 %iv, 4
21 %ec = icmp ne i8 %iv, %N
22 br i1 %ec, label %loop, label %exit
28 define void @max_backedge_taken_count_by_wrapping1_nuw(i8 %N, i8* %ptr) {
29 ; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping1_nuw
30 ; CHECK-NEXT: Loop %loop: backedge-taken count is (%N /u 4)
31 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
32 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (%N /u 4)
38 %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]
39 %gep = getelementptr i8, i8* %ptr, i8 %iv
40 store i8 %iv, i8* %gep
41 %iv.next = add nuw i8 %iv, 4
42 %ec = icmp ne i8 %iv, %N
43 br i1 %ec, label %loop, label %exit
49 define void @max_backedge_taken_count_by_wrapping2_nsw_nuw(i8 %N, i8* %ptr) {
50 ; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping2
51 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((-64 + %N) /u 4)
52 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
53 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-64 + %N) /u 4)
59 %iv = phi i8 [ 64, %entry ], [ %iv.next, %loop ]
60 %gep = getelementptr i8, i8* %ptr, i8 %iv
61 store i8 %iv, i8* %gep
62 %iv.next = add nuw nsw i8 %iv, 4
63 %ec = icmp ne i8 %iv, %N
64 br i1 %ec, label %loop, label %exit
70 define void @max_backedge_taken_count_by_wrapping2_nuw(i8 %N, i8* %ptr) {
71 ; CHECK-LABEL: Determining loop execution counts for: @max_backedge_taken_count_by_wrapping2
72 ; CHECK-NEXT: Loop %loop: backedge-taken count is ((-64 + %N) /u 4)
73 ; CHECK-NEXT: Loop %loop: max backedge-taken count is 63
74 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-64 + %N) /u 4)
80 %iv = phi i8 [ 64, %entry ], [ %iv.next, %loop ]
81 %gep = getelementptr i8, i8* %ptr, i8 %iv
82 store i8 %iv, i8* %gep
83 %iv.next = add nuw i8 %iv, 4
84 %ec = icmp ne i8 %iv, %N
85 br i1 %ec, label %loop, label %exit