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 3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-unknown-linux-gnu" 6 7define 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) 12; 13entry: 14 br label %loop 15 16loop: 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 23 24exit: 25 ret void 26} 27 28define 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) 33; 34entry: 35 br label %loop 36 37loop: 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 44 45exit: 46 ret void 47} 48 49define 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) 54; 55entry: 56 br label %loop 57 58loop: 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 65 66exit: 67 ret void 68} 69 70define 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) 75; 76entry: 77 br label %loop 78 79loop: 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 86 87exit: 88 ret void 89} 90