1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
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 @A = weak global [1000 x i32] zeroinitializer, align 32
9 define void @PR1101(i32 %N) {
10 ; CHECK-LABEL: 'PR1101'
11 ; CHECK-NEXT: Determining loop execution counts for: @PR1101
12 ; CHECK-NEXT: Loop %bb3: backedge-taken count is 10000
13 ; CHECK-NEXT: Loop %bb3: max backedge-taken count is 10000
14 ; CHECK-NEXT: Loop %bb3: Predicated backedge-taken count is 10000
15 ; CHECK-NEXT: Predicates:
16 ; CHECK: Loop %bb3: Trip multiple is 10001
22 %tmp = getelementptr [1000 x i32], [1000 x i32]* @A, i32 0, i32 %i.0 ; <i32*> [#uses=1]
23 store i32 123, i32* %tmp
24 %tmp2 = add i32 %i.0, 1 ; <i32> [#uses=1]
27 bb3: ; preds = %bb, %entry
28 %i.0 = phi i32 [ 0, %entry ], [ %tmp2, %bb ] ; <i32> [#uses=3]
29 %tmp3 = icmp sle i32 %i.0, 9999 ; <i1> [#uses=1]
30 br i1 %tmp3, label %bb, label %bb5
35 return: ; preds = %bb5
39 define i32 @PR22795() {
40 ; CHECK-LABEL: 'PR22795'
41 ; CHECK-NEXT: Determining loop execution counts for: @PR22795
42 ; CHECK-NEXT: Loop %preheader: backedge-taken count is 7
43 ; CHECK-NEXT: Loop %preheader: max backedge-taken count is 7
44 ; CHECK-NEXT: Loop %preheader: Predicated backedge-taken count is 7
45 ; CHECK-NEXT: Predicates:
46 ; CHECK: Loop %preheader: Trip multiple is 8
49 %bins = alloca [16 x i64], align 16
50 %0 = bitcast [16 x i64]* %bins to i8*
51 call void @llvm.memset.p0i8.i64(i8* align 16 %0, i8 0, i64 128, i1 false)
54 preheader: ; preds = %for.inc.1, %entry
55 %v11 = phi i64 [ 0, %entry ], [ %next12.1, %for.inc.1 ]
56 %iv = phi i32 [ -1, %entry ], [ %next.1, %for.inc.1 ]
57 %cmp = icmp sgt i64 %v11, 0
58 br i1 %cmp, label %for.body, label %for.inc
60 for.body: ; preds = %preheader
61 %zext = zext i32 %iv to i64
62 %arrayidx = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 %v11
63 %loaded = load i64, i64* %arrayidx, align 8
64 %add = add i64 %loaded, 1
65 %add2 = add i64 %add, %zext
66 store i64 %add2, i64* %arrayidx, align 8
69 for.inc: ; preds = %for.body, %preheader
70 %next12 = add nuw nsw i64 %v11, 1
71 %next = add nsw i32 %iv, 1
72 br i1 true, label %for.body.1, label %for.inc.1
74 end: ; preds = %for.inc.1
75 %arrayidx8 = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 2
76 %load = load i64, i64* %arrayidx8, align 16
77 %shr4 = lshr i64 %load, 32
78 %conv = trunc i64 %shr4 to i32
81 for.body.1: ; preds = %for.inc
82 %zext.1 = zext i32 %next to i64
83 %arrayidx.1 = getelementptr [16 x i64], [16 x i64]* %bins, i64 0, i64 %next12
84 %loaded.1 = load i64, i64* %arrayidx.1, align 8
85 %add.1 = add i64 %loaded.1, 1
86 %add2.1 = add i64 %add.1, %zext.1
87 store i64 %add2.1, i64* %arrayidx.1, align 8
90 for.inc.1: ; preds = %for.body.1, %for.inc
91 %next12.1 = add nuw nsw i64 %next12, 1
92 %next.1 = add nuw nsw i32 %next, 1
93 %exitcond.1 = icmp eq i64 %next12.1, 16
94 br i1 %exitcond.1, label %end, label %preheader
97 ; Function Attrs: nounwind
98 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) #0
100 declare void @may_exit() nounwind
102 define void @pr28012(i32 %n) {
103 ; CHECK-LABEL: 'pr28012'
104 ; CHECK-NEXT: Determining loop execution counts for: @pr28012
105 ; CHECK-NEXT: Loop %loop: backedge-taken count is -1431655751
106 ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1431655751
107 ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is -1431655751
108 ; CHECK-NEXT: Predicates:
109 ; CHECK: Loop %loop: Trip multiple is 2863311546
115 %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
116 %iv.inc = add nsw i32 %iv, 3
117 call void @may_exit()
118 %becond = icmp ne i32 %iv.inc, 46
119 br i1 %becond, label %loop, label %leave