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