1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
4 ; Tests loops with huge trip counts. Trip count of >=2^32 are huge. Huge trip counts have a trip multiple
5 ; of the greatest power of 2 less than 2^32.
9 define void @trip_count_4294967295() {
10 ; CHECK-LABEL: 'trip_count_4294967295'
11 ; CHECK-NEXT: Classifying expressions for: @trip_count_4294967295
12 ; CHECK-NEXT: %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
13 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.body> U: [0,4294967295) S: [0,4294967295) Exits: 4294967294 LoopDispositions: { %for.body: Computable }
14 ; CHECK-NEXT: %add = add nuw nsw i64 %i.02, 1
15 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%for.body> U: [1,4294967296) S: [1,4294967296) Exits: 4294967295 LoopDispositions: { %for.body: Computable }
16 ; CHECK-NEXT: Determining loop execution counts for: @trip_count_4294967295
17 ; CHECK-NEXT: Loop %for.body: backedge-taken count is 4294967294
18 ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is 4294967294
19 ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 4294967294
20 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 4294967294
21 ; CHECK-NEXT: Predicates:
22 ; CHECK-NEXT: Loop %for.body: Trip multiple is 4294967295
27 for.cond.cleanup: ; preds = %for.body
30 for.body: ; preds = %entry, %for.body
31 %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
32 tail call void (...) @foo() #2
33 %add = add nuw nsw i64 %i.02, 1
34 %exitcond.not = icmp eq i64 %add, 4294967295
35 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
38 define void @trip_count_4294967296() {
39 ; CHECK-LABEL: 'trip_count_4294967296'
40 ; CHECK-NEXT: Classifying expressions for: @trip_count_4294967296
41 ; CHECK-NEXT: %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
42 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.body> U: [0,4294967296) S: [0,4294967296) Exits: 4294967295 LoopDispositions: { %for.body: Computable }
43 ; CHECK-NEXT: %add = add nuw nsw i64 %i.02, 1
44 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%for.body> U: [1,4294967297) S: [1,4294967297) Exits: 4294967296 LoopDispositions: { %for.body: Computable }
45 ; CHECK-NEXT: Determining loop execution counts for: @trip_count_4294967296
46 ; CHECK-NEXT: Loop %for.body: backedge-taken count is 4294967295
47 ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is 4294967295
48 ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 4294967295
49 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 4294967295
50 ; CHECK-NEXT: Predicates:
51 ; CHECK-NEXT: Loop %for.body: Trip multiple is 2147483648
56 for.cond.cleanup: ; preds = %for.body
59 for.body: ; preds = %entry, %for.body
60 %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
61 tail call void (...) @foo() #2
62 %add = add nuw nsw i64 %i.02, 1
63 %exitcond.not = icmp eq i64 %add, 4294967296
64 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
67 define void @trip_count_8589935692() {
68 ; CHECK-LABEL: 'trip_count_8589935692'
69 ; CHECK-NEXT: Classifying expressions for: @trip_count_8589935692
70 ; CHECK-NEXT: %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
71 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.body> U: [0,8589934592) S: [0,8589934592) Exits: 8589934591 LoopDispositions: { %for.body: Computable }
72 ; CHECK-NEXT: %add = add nuw nsw i64 %i.02, 1
73 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%for.body> U: [1,8589934593) S: [1,8589934593) Exits: 8589934592 LoopDispositions: { %for.body: Computable }
74 ; CHECK-NEXT: Determining loop execution counts for: @trip_count_8589935692
75 ; CHECK-NEXT: Loop %for.body: backedge-taken count is 8589934591
76 ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is 8589934591
77 ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 8589934591
78 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 8589934591
79 ; CHECK-NEXT: Predicates:
80 ; CHECK-NEXT: Loop %for.body: Trip multiple is 2147483648
85 for.cond.cleanup: ; preds = %for.body
88 for.body: ; preds = %entry, %for.body
89 %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
90 tail call void (...) @foo() #2
91 %add = add nuw nsw i64 %i.02, 1
92 %exitcond.not = icmp eq i64 %add, 8589934592
93 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
96 define void @trip_count_9223372036854775808() {
97 ; CHECK-LABEL: 'trip_count_9223372036854775808'
98 ; CHECK-NEXT: Classifying expressions for: @trip_count_9223372036854775808
99 ; CHECK-NEXT: %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
100 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.body> U: [0,-9223372036854775808) S: [0,-9223372036854775808) Exits: 9223372036854775807 LoopDispositions: { %for.body: Computable }
101 ; CHECK-NEXT: %add = add nuw nsw i64 %i.02, 1
102 ; CHECK-NEXT: --> {1,+,1}<nuw><%for.body> U: [1,-9223372036854775807) S: [1,-9223372036854775807) Exits: -9223372036854775808 LoopDispositions: { %for.body: Computable }
103 ; CHECK-NEXT: Determining loop execution counts for: @trip_count_9223372036854775808
104 ; CHECK-NEXT: Loop %for.body: backedge-taken count is 9223372036854775807
105 ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is 9223372036854775807
106 ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is 9223372036854775807
107 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is 9223372036854775807
108 ; CHECK-NEXT: Predicates:
109 ; CHECK-NEXT: Loop %for.body: Trip multiple is 2147483648
114 for.cond.cleanup: ; preds = %for.body
117 for.body: ; preds = %entry, %for.body
118 %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
119 tail call void (...) @foo() #2
120 %add = add nuw nsw i64 %i.02, 1
121 %exitcond.not = icmp eq i64 %add, 9223372036854775808
122 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
125 define void @trip_count_18446744073709551615() {
126 ; CHECK-LABEL: 'trip_count_18446744073709551615'
127 ; CHECK-NEXT: Classifying expressions for: @trip_count_18446744073709551615
128 ; CHECK-NEXT: %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
129 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%for.body> U: [0,-9223372036854775808) S: [0,-9223372036854775808) Exits: -2 LoopDispositions: { %for.body: Computable }
130 ; CHECK-NEXT: %add = add nuw nsw i64 %i.02, 1
131 ; CHECK-NEXT: --> {1,+,1}<nuw><%for.body> U: [1,0) S: [1,0) Exits: -1 LoopDispositions: { %for.body: Computable }
132 ; CHECK-NEXT: Determining loop execution counts for: @trip_count_18446744073709551615
133 ; CHECK-NEXT: Loop %for.body: backedge-taken count is -2
134 ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is -2
135 ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is -2
136 ; CHECK-NEXT: Loop %for.body: Predicated backedge-taken count is -2
137 ; CHECK-NEXT: Predicates:
138 ; CHECK-NEXT: Loop %for.body: Trip multiple is 1
143 for.cond.cleanup: ; preds = %for.body
146 for.body: ; preds = %entry, %for.body
147 %i.02 = phi i64 [ 0, %entry ], [ %add, %for.body ]
148 tail call void (...) @foo() #2
149 %add = add nuw nsw i64 %i.02, 1
150 %exitcond.not = icmp eq i64 %add, 18446744073709551615
151 br i1 %exitcond.not, label %for.cond.cleanup, label %for.body