1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
4 define ptr @pointer_select_two_objects(i1 %cond, ptr %first_obj, ptr %second_obj) {
5 ; CHECK-LABEL: 'pointer_select_two_objects'
6 ; CHECK-NEXT: Classifying expressions for: @pointer_select_two_objects
7 ; CHECK-NEXT: %r = select i1 %cond, ptr %first_obj, ptr %second_obj
8 ; CHECK-NEXT: --> %r U: full-set S: full-set
9 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_two_objects
11 %r = select i1 %cond, ptr %first_obj, ptr %second_obj
17 define ptr @pointer_select_same_object_constant_offsets(i1 %cond, ptr %obj) {
18 ; CHECK-LABEL: 'pointer_select_same_object_constant_offsets'
19 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_constant_offsets
20 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 42
21 ; CHECK-NEXT: --> (42 + %obj) U: full-set S: full-set
22 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 24
23 ; CHECK-NEXT: --> (24 + %obj) U: full-set S: full-set
24 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
25 ; CHECK-NEXT: --> %r U: full-set S: full-set
26 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_constant_offsets
28 %true_ptr = getelementptr i8, ptr %obj, i64 42
29 %false_ptr = getelementptr i8, ptr %obj, i64 24
30 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
34 define ptr @pointer_select_same_object_variable_offsets(i1 %cond, ptr %obj, i64 %true_off, i64 %false_off) {
35 ; CHECK-LABEL: 'pointer_select_same_object_variable_offsets'
36 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_variable_offsets
37 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
38 ; CHECK-NEXT: --> (%true_off + %obj) U: full-set S: full-set
39 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
40 ; CHECK-NEXT: --> (%false_off + %obj) U: full-set S: full-set
41 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
42 ; CHECK-NEXT: --> %r U: full-set S: full-set
43 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_variable_offsets
45 %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
46 %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
47 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
51 define ptr @pointer_select_same_object_constant_offset_vs_variable_offset(i1 %cond, ptr %obj, i64 %false_off) {
52 ; CHECK-LABEL: 'pointer_select_same_object_constant_offset_vs_variable_offset'
53 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_constant_offset_vs_variable_offset
54 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 42
55 ; CHECK-NEXT: --> (42 + %obj) U: full-set S: full-set
56 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
57 ; CHECK-NEXT: --> (%false_off + %obj) U: full-set S: full-set
58 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
59 ; CHECK-NEXT: --> %r U: full-set S: full-set
60 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_constant_offset_vs_variable_offset
62 %true_ptr = getelementptr i8, ptr %obj, i64 42
63 %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
64 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
68 define ptr @pointer_select_same_object_variable_offset_vs_constant_offset(i1 %cond, ptr %obj, i64 %true_off) {
69 ; CHECK-LABEL: 'pointer_select_same_object_variable_offset_vs_constant_offset'
70 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_variable_offset_vs_constant_offset
71 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
72 ; CHECK-NEXT: --> (%true_off + %obj) U: full-set S: full-set
73 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 42
74 ; CHECK-NEXT: --> (42 + %obj) U: full-set S: full-set
75 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
76 ; CHECK-NEXT: --> %r U: full-set S: full-set
77 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_variable_offset_vs_constant_offset
79 %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
80 %false_ptr = getelementptr i8, ptr %obj, i64 42
81 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
87 define ptr @pointer_select_same_object_with_constant_base_offset__constant_offsets(i1 %cond, ptr %obj.base) {
88 ; CHECK-LABEL: 'pointer_select_same_object_with_constant_base_offset__constant_offsets'
89 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_constant_base_offset__constant_offsets
90 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 12
91 ; CHECK-NEXT: --> (12 + %obj.base) U: full-set S: full-set
92 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 42
93 ; CHECK-NEXT: --> (54 + %obj.base) U: full-set S: full-set
94 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 24
95 ; CHECK-NEXT: --> (36 + %obj.base) U: full-set S: full-set
96 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
97 ; CHECK-NEXT: --> %r U: full-set S: full-set
98 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_constant_base_offset__constant_offsets
100 %obj = getelementptr i8, ptr %obj.base, i64 12
101 %true_ptr = getelementptr i8, ptr %obj, i64 42
102 %false_ptr = getelementptr i8, ptr %obj, i64 24
103 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
107 define ptr @pointer_select_same_object_with_constant_base_offset__variable_offsets(i1 %cond, ptr %obj.base, i64 %true_off, i64 %false_off) {
108 ; CHECK-LABEL: 'pointer_select_same_object_with_constant_base_offset__variable_offsets'
109 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_constant_base_offset__variable_offsets
110 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 12
111 ; CHECK-NEXT: --> (12 + %obj.base) U: full-set S: full-set
112 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
113 ; CHECK-NEXT: --> (12 + %true_off + %obj.base) U: full-set S: full-set
114 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
115 ; CHECK-NEXT: --> (12 + %false_off + %obj.base) U: full-set S: full-set
116 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
117 ; CHECK-NEXT: --> %r U: full-set S: full-set
118 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_constant_base_offset__variable_offsets
120 %obj = getelementptr i8, ptr %obj.base, i64 12
121 %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
122 %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
123 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
127 define ptr @pointer_select_same_object_with_constant_base_offset__constant_offset_vs_variable_offset(i1 %cond, ptr %obj.base, i64 %false_off) {
128 ; CHECK-LABEL: 'pointer_select_same_object_with_constant_base_offset__constant_offset_vs_variable_offset'
129 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_constant_base_offset__constant_offset_vs_variable_offset
130 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 12
131 ; CHECK-NEXT: --> (12 + %obj.base) U: full-set S: full-set
132 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 42
133 ; CHECK-NEXT: --> (54 + %obj.base) U: full-set S: full-set
134 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
135 ; CHECK-NEXT: --> (12 + %false_off + %obj.base) U: full-set S: full-set
136 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
137 ; CHECK-NEXT: --> %r U: full-set S: full-set
138 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_constant_base_offset__constant_offset_vs_variable_offset
140 %obj = getelementptr i8, ptr %obj.base, i64 12
141 %true_ptr = getelementptr i8, ptr %obj, i64 42
142 %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
143 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
147 define ptr @pointer_select_same_object_with_constant_base_offset__variable_offset_vs_constant_offset(i1 %cond, ptr %obj.base, i64 %true_off) {
148 ; CHECK-LABEL: 'pointer_select_same_object_with_constant_base_offset__variable_offset_vs_constant_offset'
149 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_constant_base_offset__variable_offset_vs_constant_offset
150 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 12
151 ; CHECK-NEXT: --> (12 + %obj.base) U: full-set S: full-set
152 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
153 ; CHECK-NEXT: --> (12 + %true_off + %obj.base) U: full-set S: full-set
154 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 42
155 ; CHECK-NEXT: --> (54 + %obj.base) U: full-set S: full-set
156 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
157 ; CHECK-NEXT: --> %r U: full-set S: full-set
158 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_constant_base_offset__variable_offset_vs_constant_offset
160 %obj = getelementptr i8, ptr %obj.base, i64 12
161 %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
162 %false_ptr = getelementptr i8, ptr %obj, i64 42
163 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
169 define ptr @pointer_select_same_object_with_variable_base_offset__constant_offsets(i1 %cond, ptr %obj.base, i64 %base_offset) {
170 ; CHECK-LABEL: 'pointer_select_same_object_with_variable_base_offset__constant_offsets'
171 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_variable_base_offset__constant_offsets
172 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
173 ; CHECK-NEXT: --> (%base_offset + %obj.base) U: full-set S: full-set
174 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 42
175 ; CHECK-NEXT: --> (42 + %base_offset + %obj.base) U: full-set S: full-set
176 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 24
177 ; CHECK-NEXT: --> (24 + %base_offset + %obj.base) U: full-set S: full-set
178 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
179 ; CHECK-NEXT: --> %r U: full-set S: full-set
180 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_variable_base_offset__constant_offsets
182 %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
183 %true_ptr = getelementptr i8, ptr %obj, i64 42
184 %false_ptr = getelementptr i8, ptr %obj, i64 24
185 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
189 define ptr @pointer_select_same_object_with_variable_base_offset__variable_offsets(i1 %cond, ptr %obj.base, i64 %base_offset, i64 %true_off, i64 %false_off) {
190 ; CHECK-LABEL: 'pointer_select_same_object_with_variable_base_offset__variable_offsets'
191 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_variable_base_offset__variable_offsets
192 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
193 ; CHECK-NEXT: --> (%base_offset + %obj.base) U: full-set S: full-set
194 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
195 ; CHECK-NEXT: --> (%base_offset + %true_off + %obj.base) U: full-set S: full-set
196 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
197 ; CHECK-NEXT: --> (%base_offset + %false_off + %obj.base) U: full-set S: full-set
198 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
199 ; CHECK-NEXT: --> %r U: full-set S: full-set
200 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_variable_base_offset__variable_offsets
202 %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
203 %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
204 %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
205 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
209 define ptr @pointer_select_same_object_with_variable_base_offset__constant_offset_vs_variable_offset(i1 %cond, ptr %obj.base, i64 %base_offset, i64 %false_off) {
210 ; CHECK-LABEL: 'pointer_select_same_object_with_variable_base_offset__constant_offset_vs_variable_offset'
211 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_variable_base_offset__constant_offset_vs_variable_offset
212 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
213 ; CHECK-NEXT: --> (%base_offset + %obj.base) U: full-set S: full-set
214 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 42
215 ; CHECK-NEXT: --> (42 + %base_offset + %obj.base) U: full-set S: full-set
216 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
217 ; CHECK-NEXT: --> (%base_offset + %false_off + %obj.base) U: full-set S: full-set
218 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
219 ; CHECK-NEXT: --> %r U: full-set S: full-set
220 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_variable_base_offset__constant_offset_vs_variable_offset
222 %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
223 %true_ptr = getelementptr i8, ptr %obj, i64 42
224 %false_ptr = getelementptr i8, ptr %obj, i64 %false_off
225 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
229 define ptr @pointer_select_same_object_with_variable_base_offset__variable_offset_vs_constant_offset(i1 %cond, ptr %obj.base, i64 %base_offset, i64 %true_off) {
230 ; CHECK-LABEL: 'pointer_select_same_object_with_variable_base_offset__variable_offset_vs_constant_offset'
231 ; CHECK-NEXT: Classifying expressions for: @pointer_select_same_object_with_variable_base_offset__variable_offset_vs_constant_offset
232 ; CHECK-NEXT: %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
233 ; CHECK-NEXT: --> (%base_offset + %obj.base) U: full-set S: full-set
234 ; CHECK-NEXT: %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
235 ; CHECK-NEXT: --> (%base_offset + %true_off + %obj.base) U: full-set S: full-set
236 ; CHECK-NEXT: %false_ptr = getelementptr i8, ptr %obj, i64 42
237 ; CHECK-NEXT: --> (42 + %base_offset + %obj.base) U: full-set S: full-set
238 ; CHECK-NEXT: %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr
239 ; CHECK-NEXT: --> %r U: full-set S: full-set
240 ; CHECK-NEXT: Determining loop execution counts for: @pointer_select_same_object_with_variable_base_offset__variable_offset_vs_constant_offset
242 %obj = getelementptr i8, ptr %obj.base, i64 %base_offset
243 %true_ptr = getelementptr i8, ptr %obj, i64 %true_off
244 %false_ptr = getelementptr i8, ptr %obj, i64 42
245 %r = select i1 %cond, ptr %true_ptr, ptr %false_ptr