1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=16 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4 ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
7 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
9 declare token @llvm.call.preallocated.setup(i32)
10 declare i8* @llvm.call.preallocated.arg(token, i32)
12 @ConstAS3Ptr = addrspace(3) global i32 0, align 4
15 ; CHECK: @[[CONSTAS3PTR:[a-zA-Z0-9_$"\\.-]+]] = addrspace(3) global i32 0, align 4
16 ; CHECK: @[[S:[a-zA-Z0-9_$"\\.-]+]] = external global [[STRUCT_X:%.*]]
17 ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (void (i8***)* @f1 to i8*), i8* bitcast (void (i1 (i8*)*)* @f2 to i8*)] }
19 define internal i32 addrspace(3)* @const_ptr_return_as3() {
20 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
21 ; IS__CGSCC____-LABEL: define {{[^@]+}}@const_ptr_return_as3
22 ; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] {
23 ; IS__CGSCC____-NEXT: ret i32 addrspace(3)* undef
25 ret i32 addrspace(3)* @ConstAS3Ptr
27 define internal i32* @const_ptr_return() {
28 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
29 ; IS__CGSCC____-LABEL: define {{[^@]+}}@const_ptr_return
30 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
31 ; IS__CGSCC____-NEXT: ret i32* undef
33 ret i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*)
36 ; Test1: Replace argument with constant
37 define internal void @test1(i32 %a) {
38 ; CHECK-LABEL: define {{[^@]+}}@test1() {
39 ; CHECK-NEXT: tail call void @f(i32 noundef 1)
40 ; CHECK-NEXT: ret void
42 tail call void @f(i32 %a)
46 define void @test1_helper() {
47 ; CHECK-LABEL: define {{[^@]+}}@test1_helper() {
48 ; CHECK-NEXT: tail call void @test1()
49 ; CHECK-NEXT: ret void
51 tail call void @test1(i32 1)
55 ; TEST 2 : Simplify return value
56 define i32 @return0() {
57 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
58 ; IS__TUNIT____-LABEL: define {{[^@]+}}@return0
59 ; IS__TUNIT____-SAME: () #[[ATTR1:[0-9]+]] {
60 ; IS__TUNIT____-NEXT: ret i32 0
62 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
63 ; IS__CGSCC____-LABEL: define {{[^@]+}}@return0
64 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
65 ; IS__CGSCC____-NEXT: ret i32 0
70 define i32 @return1() {
71 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
72 ; IS__TUNIT____-LABEL: define {{[^@]+}}@return1
73 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
74 ; IS__TUNIT____-NEXT: ret i32 1
76 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
77 ; IS__CGSCC____-LABEL: define {{[^@]+}}@return1
78 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
79 ; IS__CGSCC____-NEXT: ret i32 1
84 define i32 @test2_1(i1 %c) {
85 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
86 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_1
87 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
88 ; IS__TUNIT____-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
89 ; IS__TUNIT____: if.true:
90 ; IS__TUNIT____-NEXT: [[RET0:%.*]] = add i32 0, 1
91 ; IS__TUNIT____-NEXT: br label [[END:%.*]]
92 ; IS__TUNIT____: if.false:
93 ; IS__TUNIT____-NEXT: br label [[END]]
95 ; IS__TUNIT____-NEXT: [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
96 ; IS__TUNIT____-NEXT: ret i32 1
98 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
99 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_1
100 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
101 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
102 ; IS__CGSCC____: if.true:
103 ; IS__CGSCC____-NEXT: [[RET0:%.*]] = add i32 0, 1
104 ; IS__CGSCC____-NEXT: br label [[END:%.*]]
105 ; IS__CGSCC____: if.false:
106 ; IS__CGSCC____-NEXT: br label [[END]]
107 ; IS__CGSCC____: end:
108 ; IS__CGSCC____-NEXT: [[RET:%.*]] = phi i32 [ [[RET0]], [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
109 ; IS__CGSCC____-NEXT: ret i32 1
111 br i1 %c, label %if.true, label %if.false
113 %call = tail call i32 @return0()
114 %ret0 = add i32 %call, 1
117 %ret1 = tail call i32 @return1()
121 %ret = phi i32 [ %ret0, %if.true ], [ %ret1, %if.false ]
128 define i32 @test2_2(i1 %c) {
129 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
130 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test2_2
131 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
132 ; IS__TUNIT____-NEXT: ret i32 1
134 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
135 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test2_2
136 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
137 ; IS__CGSCC____-NEXT: ret i32 1
139 %ret = tail call i32 @test2_1(i1 %c)
143 declare void @use(i32)
144 define void @test3(i1 %c) {
145 ; CHECK-LABEL: define {{[^@]+}}@test3
146 ; CHECK-SAME: (i1 [[C:%.*]]) {
147 ; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
149 ; CHECK-NEXT: br label [[END:%.*]]
151 ; CHECK-NEXT: br label [[END]]
153 ; CHECK-NEXT: [[R:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
154 ; CHECK-NEXT: tail call void @use(i32 noundef 1)
155 ; CHECK-NEXT: ret void
157 br i1 %c, label %if.true, label %if.false
161 %ret1 = tail call i32 @return1()
165 %r = phi i32 [ 1, %if.true ], [ %ret1, %if.false ]
167 tail call void @use(i32 %r)
171 define void @test-select-phi(i1 %c) {
172 ; CHECK-LABEL: define {{[^@]+}}@test-select-phi
173 ; CHECK-SAME: (i1 [[C:%.*]]) {
174 ; CHECK-NEXT: tail call void @use(i32 noundef 1)
175 ; CHECK-NEXT: [[SELECT_NOT_SAME:%.*]] = select i1 [[C]], i32 1, i32 0
176 ; CHECK-NEXT: tail call void @use(i32 noundef [[SELECT_NOT_SAME]])
177 ; CHECK-NEXT: br i1 [[C]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]
179 ; CHECK-NEXT: br label [[END:%.*]]
181 ; CHECK-NEXT: br label [[END]]
183 ; CHECK-NEXT: [[PHI_SAME:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
184 ; CHECK-NEXT: [[PHI_NOT_SAME:%.*]] = phi i32 [ 0, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
185 ; CHECK-NEXT: [[PHI_SAME_PROP:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ 1, [[IF_FALSE]] ]
186 ; CHECK-NEXT: [[PHI_SAME_UNDEF:%.*]] = phi i32 [ 1, [[IF_TRUE]] ], [ undef, [[IF_FALSE]] ]
187 ; CHECK-NEXT: [[SELECT_NOT_SAME_UNDEF:%.*]] = select i1 [[C]], i32 [[PHI_NOT_SAME]], i32 undef
188 ; CHECK-NEXT: tail call void @use(i32 noundef 1)
189 ; CHECK-NEXT: tail call void @use(i32 noundef [[PHI_NOT_SAME]])
190 ; CHECK-NEXT: tail call void @use(i32 noundef 1)
191 ; CHECK-NEXT: tail call void @use(i32 1)
192 ; CHECK-NEXT: tail call void @use(i32 [[SELECT_NOT_SAME_UNDEF]])
193 ; CHECK-NEXT: ret void
195 %select-same = select i1 %c, i32 1, i32 1
196 tail call void @use(i32 %select-same)
198 %select-not-same = select i1 %c, i32 1, i32 0
199 tail call void @use(i32 %select-not-same)
200 br i1 %c, label %if-true, label %if-false
206 %phi-same = phi i32 [ 1, %if-true ], [ 1, %if-false ]
207 %phi-not-same = phi i32 [ 0, %if-true ], [ 1, %if-false ]
208 %phi-same-prop = phi i32 [ 1, %if-true ], [ %select-same, %if-false ]
209 %phi-same-undef = phi i32 [ 1, %if-true ], [ undef, %if-false ]
210 %select-not-same-undef = select i1 %c, i32 %phi-not-same, i32 undef
213 tail call void @use(i32 %phi-same)
215 tail call void @use(i32 %phi-not-same)
217 tail call void @use(i32 %phi-same-prop)
219 tail call void @use(i32 %phi-same-undef)
221 tail call void @use(i32 %select-not-same-undef)
227 define i32 @ipccp1(i32 %a) {
228 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
229 ; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp1
230 ; IS__TUNIT____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
231 ; IS__TUNIT____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]]
233 ; IS__TUNIT____-NEXT: ret i32 [[A]]
235 ; IS__TUNIT____-NEXT: unreachable
237 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
238 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp1
239 ; IS__CGSCC____-SAME: (i32 returned [[A:%.*]]) #[[ATTR1]] {
240 ; IS__CGSCC____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]]
242 ; IS__CGSCC____-NEXT: ret i32 [[A]]
244 ; IS__CGSCC____-NEXT: unreachable
246 br i1 true, label %t, label %f
250 %r = call i32 @ipccp1(i32 5)
254 define internal i1 @ipccp2i(i1 %a) {
255 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
256 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2i
257 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
258 ; IS__CGSCC____-NEXT: br label [[T:%.*]]
260 ; IS__CGSCC____-NEXT: ret i1 undef
262 ; IS__CGSCC____-NEXT: unreachable
264 br i1 %a, label %t, label %f
268 %r = call i1 @ipccp2i(i1 false)
272 define i1 @ipccp2() {
273 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
274 ; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2
275 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
276 ; IS__TUNIT____-NEXT: ret i1 true
278 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
279 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2
280 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
281 ; IS__CGSCC____-NEXT: ret i1 true
283 %r = call i1 @ipccp2i(i1 true)
287 define internal i1 @ipccp2ib(i1 %a) {
288 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
289 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2ib
290 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
291 ; IS__CGSCC____-NEXT: br label [[T:%.*]]
293 ; IS__CGSCC____-NEXT: ret i1 undef
295 ; IS__CGSCC____-NEXT: unreachable
297 br i1 %a, label %t, label %f
301 %r = call i1 @ipccp2ib(i1 false)
305 define i1 @ipccp2b() {
306 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
307 ; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp2b
308 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
309 ; IS__TUNIT____-NEXT: ret i1 true
311 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
312 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp2b
313 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
314 ; IS__CGSCC____-NEXT: ret i1 true
316 %r = call i1 @ipccp2ib(i1 true)
320 define internal i32 @ipccp3i(i32 %a) {
321 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
322 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3i
323 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
324 ; IS__CGSCC____-NEXT: br label [[T:%.*]]
326 ; IS__CGSCC____-NEXT: ret i32 undef
328 ; IS__CGSCC____-NEXT: unreachable
330 %c = icmp eq i32 %a, 7
331 br i1 %c, label %t, label %f
335 %r = call i32 @ipccp3i(i32 5)
339 define i32 @ipccp3() {
340 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
341 ; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp3
342 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
343 ; IS__TUNIT____-NEXT: ret i32 7
345 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
346 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp3
347 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
348 ; IS__CGSCC____-NEXT: ret i32 7
350 %r = call i32 @ipccp3i(i32 7)
354 define internal i32 @ipccp4ia(i1 %c) {
355 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
356 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4ia
357 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
358 ; IS__CGSCC____-NEXT: br label [[T:%.*]]
360 ; IS__CGSCC____-NEXT: ret i32 undef
362 ; IS__CGSCC____-NEXT: unreachable
364 br i1 %c, label %t, label %f
370 define internal i32 @ipccp4ib(i32 %a) {
371 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
372 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4ib
373 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
374 ; IS__CGSCC____-NEXT: [[C:%.*]] = icmp eq i32 7, 7
375 ; IS__CGSCC____-NEXT: br i1 true, label [[T:%.*]], label [[F:%.*]]
377 ; IS__CGSCC____-NEXT: ret i32 undef
379 ; IS__CGSCC____-NEXT: unreachable
381 %c = icmp eq i32 %a, 7
382 br i1 %c, label %t, label %f
384 %r = call i32 @ipccp4ia(i1 %c)
390 define i32 @ipccp4(i1 %c) {
391 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
392 ; IS__TUNIT____-LABEL: define {{[^@]+}}@ipccp4
393 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
394 ; IS__TUNIT____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
396 ; IS__TUNIT____-NEXT: br label [[F]]
398 ; IS__TUNIT____-NEXT: ret i32 0
400 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
401 ; IS__CGSCC____-LABEL: define {{[^@]+}}@ipccp4
402 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
403 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
405 ; IS__CGSCC____-NEXT: br label [[F]]
407 ; IS__CGSCC____-NEXT: ret i32 0
409 br i1 %c, label %t, label %f
411 %q = call i32 @ipccp4ia(i1 undef)
414 %r = call i32 @ipccp4ib(i32 7)
418 ; Do not touch complicated arguments (for now)
419 %struct.X = type { i8* }
420 define internal i32* @test_inalloca(i32* inalloca(i32) %a) {
421 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
422 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_inalloca
423 ; IS__TUNIT____-SAME: (i32* noalias nofree nonnull returned writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
424 ; IS__TUNIT____-NEXT: ret i32* [[A]]
426 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
427 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_inalloca
428 ; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly inalloca(i32) dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
429 ; IS__CGSCC____-NEXT: ret i32* [[A]]
433 define i32* @complicated_args_inalloca(i32* %arg) {
434 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
435 ; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_inalloca
436 ; IS__TUNIT____-SAME: (i32* nofree readnone "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
437 ; IS__TUNIT____-NEXT: [[CALL:%.*]] = call nonnull dereferenceable(4) i32* @test_inalloca(i32* noalias nofree writeonly inalloca(i32) "no-capture-maybe-returned" [[ARG]]) #[[ATTR1]]
438 ; IS__TUNIT____-NEXT: ret i32* [[CALL]]
440 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
441 ; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_inalloca
442 ; IS__CGSCC____-SAME: (i32* nofree noundef nonnull readnone returned dereferenceable(4) "no-capture-maybe-returned" [[ARG:%.*]]) #[[ATTR1]] {
443 ; IS__CGSCC____-NEXT: ret i32* [[ARG]]
445 %call = call i32* @test_inalloca(i32* inalloca(i32) %arg)
449 define internal i32* @test_preallocated(i32* preallocated(i32) %a) {
450 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
451 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_preallocated
452 ; IS__TUNIT____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
453 ; IS__TUNIT____-NEXT: ret i32* [[A]]
455 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
456 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_preallocated
457 ; IS__CGSCC____-SAME: (i32* noalias nofree noundef nonnull returned writeonly preallocated(i32) align 536870912 dereferenceable(4) "no-capture-maybe-returned" [[A:%.*]]) #[[ATTR1]] {
458 ; IS__CGSCC____-NEXT: ret i32* [[A]]
462 define i32* @complicated_args_preallocated() {
463 ; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn
464 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
465 ; IS__TUNIT_OPM-SAME: () #[[ATTR0:[0-9]+]] {
466 ; IS__TUNIT_OPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR5:[0-9]+]]
467 ; IS__TUNIT_OPM-NEXT: [[CALL:%.*]] = call noundef nonnull align 536870912 dereferenceable(4) i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR1]] [ "preallocated"(token [[C]]) ]
468 ; IS__TUNIT_OPM-NEXT: ret i32* [[CALL]]
470 ; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn
471 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
472 ; IS__TUNIT_NPM-SAME: () #[[ATTR0:[0-9]+]] {
473 ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR4:[0-9]+]]
474 ; IS__TUNIT_NPM-NEXT: [[CALL:%.*]] = call noundef nonnull align 536870912 dereferenceable(4) i32* @test_preallocated(i32* noalias nocapture nofree noundef writeonly preallocated(i32) align 536870912 null) #[[ATTR1]] [ "preallocated"(token [[C]]) ]
475 ; IS__TUNIT_NPM-NEXT: ret i32* [[CALL]]
477 ; IS__CGSCC_OPM: Function Attrs: nofree nosync nounwind willreturn
478 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
479 ; IS__CGSCC_OPM-SAME: () #[[ATTR0:[0-9]+]] {
480 ; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR5:[0-9]+]]
481 ; IS__CGSCC_OPM-NEXT: ret i32* null
483 ; IS__CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
484 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_preallocated
485 ; IS__CGSCC_NPM-SAME: () #[[ATTR0:[0-9]+]] {
486 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call token @llvm.call.preallocated.setup(i32 noundef 1) #[[ATTR4:[0-9]+]]
487 ; IS__CGSCC_NPM-NEXT: ret i32* null
489 %c = call token @llvm.call.preallocated.setup(i32 1)
490 %call = call i32* @test_preallocated(i32* preallocated(i32) null) ["preallocated"(token %c)]
494 define internal void @test_sret(%struct.X* sret(%struct.X) %a, %struct.X** %b) {
496 ; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
497 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_sret
498 ; IS__TUNIT____-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 536870912 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2:[0-9]+]] {
499 ; IS__TUNIT____-NEXT: store %struct.X* [[A]], %struct.X** [[B]], align 8
500 ; IS__TUNIT____-NEXT: ret void
502 ; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
503 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_sret
504 ; IS__CGSCC____-SAME: (%struct.X* noalias nofree noundef nonnull writeonly sret([[STRUCT_X:%.*]]) align 536870912 dereferenceable(8) [[A:%.*]], %struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2:[0-9]+]] {
505 ; IS__CGSCC____-NEXT: store %struct.X* [[A]], %struct.X** [[B]], align 8
506 ; IS__CGSCC____-NEXT: ret void
508 store %struct.X* %a, %struct.X** %b
511 ; FIXME: Alignment and dereferenceability are not propagated to the argument
512 define void @complicated_args_sret(%struct.X** %b) {
514 ; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
515 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_sret
516 ; IS__TUNIT_OPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR2]] {
517 ; IS__TUNIT_OPM-NEXT: call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly sret([[STRUCT_X:%.*]]) align 536870912 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR4:[0-9]+]]
518 ; IS__TUNIT_OPM-NEXT: ret void
520 ; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
521 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_sret
522 ; IS__TUNIT_NPM-SAME: (%struct.X** nocapture nofree writeonly [[B:%.*]]) #[[ATTR2]] {
523 ; IS__TUNIT_NPM-NEXT: call void @test_sret(%struct.X* noalias nocapture nofree noundef writeonly sret([[STRUCT_X:%.*]]) align 536870912 null, %struct.X** nocapture nofree writeonly align 8 [[B]]) #[[ATTR3:[0-9]+]]
524 ; IS__TUNIT_NPM-NEXT: ret void
526 ; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
527 ; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_sret
528 ; IS__CGSCC____-SAME: (%struct.X** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[B:%.*]]) #[[ATTR2]] {
529 ; IS__CGSCC____-NEXT: unreachable
531 call void @test_sret(%struct.X* sret(%struct.X) null, %struct.X** %b)
535 define internal %struct.X* @test_nest(%struct.X* nest %a) {
536 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
537 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_nest
538 ; IS__CGSCC____-SAME: (%struct.X* nest noalias nocapture nofree readnone align 536870912 [[A:%.*]]) #[[ATTR1]] {
539 ; IS__CGSCC____-NEXT: ret %struct.X* undef
543 define %struct.X* @complicated_args_nest() {
544 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
545 ; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_nest
546 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
547 ; IS__TUNIT____-NEXT: ret %struct.X* null
549 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
550 ; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_nest
551 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
552 ; IS__CGSCC____-NEXT: ret %struct.X* null
554 %call = call %struct.X* @test_nest(%struct.X* null)
558 @S = external global %struct.X
559 define internal void @test_byval(%struct.X* byval(%struct.X) %a) {
560 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
561 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test_byval
562 ; IS__CGSCC_OPM-SAME: (%struct.X* noalias nocapture nofree noundef nonnull writeonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR1]] {
563 ; IS__CGSCC_OPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A]], i32 0, i32 0
564 ; IS__CGSCC_OPM-NEXT: store i8* null, i8** [[G0]], align 8
565 ; IS__CGSCC_OPM-NEXT: ret void
567 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
568 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval
569 ; IS__CGSCC_NPM-SAME: (i8* noalias nocapture nofree readnone [[TMP0:%.*]]) #[[ATTR1]] {
570 ; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
571 ; IS__CGSCC_NPM-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
572 ; IS__CGSCC_NPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
573 ; IS__CGSCC_NPM-NEXT: store i8* null, i8** [[G0]], align 8
574 ; IS__CGSCC_NPM-NEXT: ret void
576 %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0
577 store i8* null, i8** %g0
580 define void @complicated_args_byval() {
581 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
582 ; IS__TUNIT____-LABEL: define {{[^@]+}}@complicated_args_byval
583 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
584 ; IS__TUNIT____-NEXT: ret void
586 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
587 ; IS__CGSCC____-LABEL: define {{[^@]+}}@complicated_args_byval
588 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
589 ; IS__CGSCC____-NEXT: ret void
591 call void @test_byval(%struct.X* byval(%struct.X) @S)
596 ; Make sure we *do not* load @S here!
597 define internal i8*@test_byval2(%struct.X* byval(%struct.X) %a) {
598 ; IS________OPM-LABEL: define {{[^@]+}}@test_byval2
599 ; IS________OPM-SAME: (%struct.X* noalias nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) [[A:%.*]]) {
600 ; IS________OPM-NEXT: call void @sync()
601 ; IS________OPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A]], i32 0, i32 0
602 ; IS________OPM-NEXT: [[L:%.*]] = load i8*, i8** [[G0]], align 8
603 ; IS________OPM-NEXT: ret i8* [[L]]
605 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test_byval2
606 ; IS__TUNIT_NPM-SAME: (i8* [[TMP0:%.*]]) {
607 ; IS__TUNIT_NPM-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
608 ; IS__TUNIT_NPM-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
609 ; IS__TUNIT_NPM-NEXT: store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
610 ; IS__TUNIT_NPM-NEXT: call void @sync()
611 ; IS__TUNIT_NPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
612 ; IS__TUNIT_NPM-NEXT: [[L:%.*]] = load i8*, i8** [[G0]], align 8
613 ; IS__TUNIT_NPM-NEXT: ret i8* [[L]]
615 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test_byval2
616 ; IS__CGSCC_NPM-SAME: (i8* noalias nofree readnone returned "no-capture-maybe-returned" [[TMP0:%.*]]) {
617 ; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca [[STRUCT_X:%.*]], align 8
618 ; IS__CGSCC_NPM-NEXT: [[A_PRIV_CAST:%.*]] = bitcast %struct.X* [[A_PRIV]] to i8**
619 ; IS__CGSCC_NPM-NEXT: store i8* [[TMP0]], i8** [[A_PRIV_CAST]], align 8
620 ; IS__CGSCC_NPM-NEXT: call void @sync()
621 ; IS__CGSCC_NPM-NEXT: [[G0:%.*]] = getelementptr [[STRUCT_X]], %struct.X* [[A_PRIV]], i32 0, i32 0
622 ; IS__CGSCC_NPM-NEXT: [[L:%.*]] = load i8*, i8** [[G0]], align 8
623 ; IS__CGSCC_NPM-NEXT: ret i8* [[TMP0]]
626 %g0 = getelementptr %struct.X, %struct.X* %a, i32 0, i32 0
627 %l = load i8*, i8** %g0
630 define i8* @complicated_args_byval2() {
632 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
633 ; IS__TUNIT_OPM-NEXT: [[C:%.*]] = call i8* @test_byval2(%struct.X* nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) @S)
634 ; IS__TUNIT_OPM-NEXT: ret i8* [[C]]
636 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
637 ; IS__TUNIT_NPM-NEXT: [[S_CAST:%.*]] = bitcast %struct.X* @S to i8**
638 ; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load i8*, i8** [[S_CAST]], align 8
639 ; IS__TUNIT_NPM-NEXT: [[C:%.*]] = call i8* @test_byval2(i8* [[TMP1]])
640 ; IS__TUNIT_NPM-NEXT: ret i8* [[C]]
642 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
643 ; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call i8* @test_byval2(%struct.X* noalias nocapture nofree noundef nonnull readonly byval([[STRUCT_X:%.*]]) align 8 dereferenceable(8) @S)
644 ; IS__CGSCC_OPM-NEXT: ret i8* [[C]]
646 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@complicated_args_byval2() {
647 ; IS__CGSCC_NPM-NEXT: [[TMP1:%.*]] = load i8*, i8** getelementptr inbounds ([[STRUCT_X:%.*]], %struct.X* @S, i32 0, i32 0), align 8
648 ; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i8* @test_byval2(i8* noalias nofree readnone "no-capture-maybe-returned" [[TMP1]])
649 ; IS__CGSCC_NPM-NEXT: ret i8* [[TMP1]]
651 %c = call i8* @test_byval2(%struct.X* byval(%struct.X) @S)
655 define void @fixpoint_changed(i32* %p) {
656 ; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind writeonly
657 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
658 ; IS__TUNIT_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR3:[0-9]+]] {
659 ; IS__TUNIT_OPM-NEXT: entry:
660 ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND:%.*]]
661 ; IS__TUNIT_OPM: for.cond:
662 ; IS__TUNIT_OPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
663 ; IS__TUNIT_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
664 ; IS__TUNIT_OPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
665 ; IS__TUNIT_OPM: for.body:
666 ; IS__TUNIT_OPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
667 ; IS__TUNIT_OPM-NEXT: i32 1, label [[SW_BB:%.*]]
668 ; IS__TUNIT_OPM-NEXT: ]
669 ; IS__TUNIT_OPM: sw.bb:
670 ; IS__TUNIT_OPM-NEXT: br label [[SW_EPILOG]]
671 ; IS__TUNIT_OPM: sw.epilog:
672 ; IS__TUNIT_OPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
673 ; IS__TUNIT_OPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
674 ; IS__TUNIT_OPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
675 ; IS__TUNIT_OPM-NEXT: br label [[FOR_COND]]
676 ; IS__TUNIT_OPM: for.end:
677 ; IS__TUNIT_OPM-NEXT: ret void
679 ; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
680 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@fixpoint_changed
681 ; IS__TUNIT_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
682 ; IS__TUNIT_NPM-NEXT: entry:
683 ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND:%.*]]
684 ; IS__TUNIT_NPM: for.cond:
685 ; IS__TUNIT_NPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
686 ; IS__TUNIT_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
687 ; IS__TUNIT_NPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
688 ; IS__TUNIT_NPM: for.body:
689 ; IS__TUNIT_NPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
690 ; IS__TUNIT_NPM-NEXT: i32 1, label [[SW_BB:%.*]]
691 ; IS__TUNIT_NPM-NEXT: ]
692 ; IS__TUNIT_NPM: sw.bb:
693 ; IS__TUNIT_NPM-NEXT: br label [[SW_EPILOG]]
694 ; IS__TUNIT_NPM: sw.epilog:
695 ; IS__TUNIT_NPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
696 ; IS__TUNIT_NPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
697 ; IS__TUNIT_NPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
698 ; IS__TUNIT_NPM-NEXT: br label [[FOR_COND]]
699 ; IS__TUNIT_NPM: for.end:
700 ; IS__TUNIT_NPM-NEXT: ret void
702 ; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind writeonly
703 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@fixpoint_changed
704 ; IS__CGSCC_OPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR3:[0-9]+]] {
705 ; IS__CGSCC_OPM-NEXT: entry:
706 ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND:%.*]]
707 ; IS__CGSCC_OPM: for.cond:
708 ; IS__CGSCC_OPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
709 ; IS__CGSCC_OPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
710 ; IS__CGSCC_OPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
711 ; IS__CGSCC_OPM: for.body:
712 ; IS__CGSCC_OPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
713 ; IS__CGSCC_OPM-NEXT: i32 1, label [[SW_BB:%.*]]
714 ; IS__CGSCC_OPM-NEXT: ]
715 ; IS__CGSCC_OPM: sw.bb:
716 ; IS__CGSCC_OPM-NEXT: br label [[SW_EPILOG]]
717 ; IS__CGSCC_OPM: sw.epilog:
718 ; IS__CGSCC_OPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
719 ; IS__CGSCC_OPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
720 ; IS__CGSCC_OPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
721 ; IS__CGSCC_OPM-NEXT: br label [[FOR_COND]]
722 ; IS__CGSCC_OPM: for.end:
723 ; IS__CGSCC_OPM-NEXT: ret void
725 ; IS__CGSCC_NPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
726 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@fixpoint_changed
727 ; IS__CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[P:%.*]]) #[[ATTR2]] {
728 ; IS__CGSCC_NPM-NEXT: entry:
729 ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND:%.*]]
730 ; IS__CGSCC_NPM: for.cond:
731 ; IS__CGSCC_NPM-NEXT: [[J_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[SW_EPILOG:%.*]] ]
732 ; IS__CGSCC_NPM-NEXT: [[CMP:%.*]] = icmp slt i32 [[J_0]], 30
733 ; IS__CGSCC_NPM-NEXT: br i1 [[CMP]], label [[FOR_BODY:%.*]], label [[FOR_END:%.*]]
734 ; IS__CGSCC_NPM: for.body:
735 ; IS__CGSCC_NPM-NEXT: switch i32 [[J_0]], label [[SW_EPILOG]] [
736 ; IS__CGSCC_NPM-NEXT: i32 1, label [[SW_BB:%.*]]
737 ; IS__CGSCC_NPM-NEXT: ]
738 ; IS__CGSCC_NPM: sw.bb:
739 ; IS__CGSCC_NPM-NEXT: br label [[SW_EPILOG]]
740 ; IS__CGSCC_NPM: sw.epilog:
741 ; IS__CGSCC_NPM-NEXT: [[X_0:%.*]] = phi i32 [ 255, [[FOR_BODY]] ], [ 253, [[SW_BB]] ]
742 ; IS__CGSCC_NPM-NEXT: store i32 [[X_0]], i32* [[P]], align 4
743 ; IS__CGSCC_NPM-NEXT: [[INC]] = add nsw i32 [[J_0]], 1
744 ; IS__CGSCC_NPM-NEXT: br label [[FOR_COND]]
745 ; IS__CGSCC_NPM: for.end:
746 ; IS__CGSCC_NPM-NEXT: ret void
752 %j.0 = phi i32 [ 0, %entry ], [ %inc, %sw.epilog ]
753 %cmp = icmp slt i32 %j.0, 30
754 br i1 %cmp, label %for.body, label %for.end
757 switch i32 %j.0, label %sw.epilog [
765 %x.0 = phi i32 [ 255, %for.body ], [ 253, %sw.bb ]
766 store i32 %x.0, i32* %p
767 %inc = add nsw i32 %j.0, 1
774 ; Check we merge undef and a constant properly.
775 define i8 @caller0() {
776 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
777 ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller0
778 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
779 ; IS__TUNIT____-NEXT: ret i8 49
781 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
782 ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller0
783 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
784 ; IS__CGSCC____-NEXT: ret i8 49
786 %c = call i8 @callee(i8 undef)
789 define i8 @caller1() {
790 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
791 ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller1
792 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
793 ; IS__TUNIT____-NEXT: ret i8 49
795 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
796 ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller1
797 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
798 ; IS__CGSCC____-NEXT: ret i8 49
800 %c = call i8 @callee(i8 undef)
803 define i8 @caller2() {
804 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
805 ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller2
806 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
807 ; IS__TUNIT____-NEXT: ret i8 49
809 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
810 ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller2
811 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
812 ; IS__CGSCC____-NEXT: ret i8 49
814 %c = call i8 @callee(i8 undef)
817 define i8 @caller_middle() {
818 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
819 ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller_middle
820 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
821 ; IS__TUNIT____-NEXT: ret i8 49
823 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
824 ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller_middle
825 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
826 ; IS__CGSCC____-NEXT: ret i8 49
828 %c = call i8 @callee(i8 42)
831 define i8 @caller3() {
832 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
833 ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller3
834 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
835 ; IS__TUNIT____-NEXT: ret i8 49
837 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
838 ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller3
839 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
840 ; IS__CGSCC____-NEXT: ret i8 49
842 %c = call i8 @callee(i8 undef)
845 define i8 @caller4() {
846 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
847 ; IS__TUNIT____-LABEL: define {{[^@]+}}@caller4
848 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
849 ; IS__TUNIT____-NEXT: ret i8 49
851 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
852 ; IS__CGSCC____-LABEL: define {{[^@]+}}@caller4
853 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
854 ; IS__CGSCC____-NEXT: ret i8 49
856 %c = call i8 @callee(i8 undef)
859 define internal i8 @callee(i8 %a) {
860 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
861 ; IS__CGSCC____-LABEL: define {{[^@]+}}@callee
862 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
863 ; IS__CGSCC____-NEXT: ret i8 undef
869 define void @user_as3() {
870 ; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn writeonly
871 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@user_as3
872 ; IS__TUNIT_OPM-SAME: () #[[ATTR4]] {
873 ; IS__TUNIT_OPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4
874 ; IS__TUNIT_OPM-NEXT: ret void
876 ; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn writeonly
877 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@user_as3
878 ; IS__TUNIT_NPM-SAME: () #[[ATTR3]] {
879 ; IS__TUNIT_NPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4
880 ; IS__TUNIT_NPM-NEXT: ret void
882 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
883 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@user_as3
884 ; IS__CGSCC_OPM-SAME: () #[[ATTR4:[0-9]+]] {
885 ; IS__CGSCC_OPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4
886 ; IS__CGSCC_OPM-NEXT: ret void
888 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
889 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@user_as3
890 ; IS__CGSCC_NPM-SAME: () #[[ATTR3:[0-9]+]] {
891 ; IS__CGSCC_NPM-NEXT: store i32 0, i32 addrspace(3)* @ConstAS3Ptr, align 4
892 ; IS__CGSCC_NPM-NEXT: ret void
894 %call = call fastcc i32 addrspace(3)* @const_ptr_return_as3()
895 store i32 0, i32 addrspace(3)* %call
898 define void @user() {
899 ; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind willreturn writeonly
900 ; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@user
901 ; IS__TUNIT_OPM-SAME: () #[[ATTR4]] {
902 ; IS__TUNIT_OPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4
903 ; IS__TUNIT_OPM-NEXT: ret void
905 ; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind willreturn writeonly
906 ; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@user
907 ; IS__TUNIT_NPM-SAME: () #[[ATTR3]] {
908 ; IS__TUNIT_NPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4
909 ; IS__TUNIT_NPM-NEXT: ret void
911 ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
912 ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@user
913 ; IS__CGSCC_OPM-SAME: () #[[ATTR4]] {
914 ; IS__CGSCC_OPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4
915 ; IS__CGSCC_OPM-NEXT: ret void
917 ; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind willreturn writeonly
918 ; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@user
919 ; IS__CGSCC_NPM-SAME: () #[[ATTR3]] {
920 ; IS__CGSCC_NPM-NEXT: store i32 0, i32* addrspacecast (i32 addrspace(3)* @ConstAS3Ptr to i32*), align 4
921 ; IS__CGSCC_NPM-NEXT: ret void
923 %call = call fastcc i32* @const_ptr_return()
924 store i32 0, i32* %call
929 define i1 @test_merge_with_undef_values_ptr(i1 %c) {
930 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
931 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_merge_with_undef_values_ptr
932 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
933 ; IS__TUNIT____-NEXT: ret i1 false
935 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
936 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_merge_with_undef_values_ptr
937 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
938 ; IS__CGSCC____-NEXT: ret i1 false
940 %r1 = call i1 @undef_then_null(i1 %c, i32* undef, i32* undef)
943 define internal i1 @undef_then_null(i1 %c, i32* %i32Aptr, i32* %i32Bptr) {
944 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
945 ; IS__CGSCC____-LABEL: define {{[^@]+}}@undef_then_null
946 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
947 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
949 ; IS__CGSCC____-NEXT: ret i1 undef
951 ; IS__CGSCC____-NEXT: ret i1 undef
953 %cmp1 = icmp eq i32* %i32Aptr, %i32Bptr
954 %cmp2 = icmp eq i1 %cmp1, false
955 %or = or i1 %cmp2, %c
956 br i1 %or, label %a, label %b
958 %r2 = call i1 @undef_then_null(i1 false, i32* null, i32* null)
964 define i1 @test_merge_with_undef_values(i1 %c) {
965 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
966 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_merge_with_undef_values
967 ; IS__TUNIT____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
968 ; IS__TUNIT____-NEXT: ret i1 false
970 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
971 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_merge_with_undef_values
972 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
973 ; IS__CGSCC____-NEXT: ret i1 false
975 %r1 = call i1 @undef_then_1(i1 %c, i32 undef, i32 undef)
978 define internal i1 @undef_then_1(i1 %c, i32 %i32A, i32 %i32B) {
980 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
981 ; IS__CGSCC____-LABEL: define {{[^@]+}}@undef_then_1
982 ; IS__CGSCC____-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
983 ; IS__CGSCC____-NEXT: br i1 [[C]], label [[A:%.*]], label [[B:%.*]]
985 ; IS__CGSCC____-NEXT: ret i1 undef
987 ; IS__CGSCC____-NEXT: ret i1 undef
989 %cmp1 = icmp eq i32 %i32A, %i32B
990 %cmp2 = icmp eq i1 %cmp1, false
991 %or = or i1 %cmp2, %c
992 br i1 %or, label %a, label %b
994 %r2 = call i1 @undef_then_1(i1 false, i32 1, i32 1)
1000 define i32 @test_select(i32 %c) {
1001 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
1002 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_select
1003 ; IS__TUNIT____-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
1004 ; IS__TUNIT____-NEXT: ret i32 42
1006 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1007 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_select
1008 ; IS__CGSCC____-SAME: (i32 [[C:%.*]]) #[[ATTR1]] {
1009 ; IS__CGSCC____-NEXT: ret i32 42
1011 %call = call i32 @select(i1 1, i32 42, i32 %c)
1015 define internal i32 @select(i1 %a, i32 %b, i32 %c) {
1016 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1017 ; IS__CGSCC____-LABEL: define {{[^@]+}}@select
1018 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
1019 ; IS__CGSCC____-NEXT: ret i32 undef
1021 %s = select i1 %a, i32 %b, i32 %c
1026 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
1027 ; IS__TUNIT____-LABEL: define {{[^@]+}}@icmp
1028 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
1029 ; IS__TUNIT____-NEXT: ret i1 true
1031 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1032 ; IS__CGSCC____-LABEL: define {{[^@]+}}@icmp
1033 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
1034 ; IS__CGSCC____-NEXT: ret i1 true
1036 %c = icmp eq i8* null, null
1040 define void @test_callee_is_undef(void (i32)* %fn) {
1041 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_callee_is_undef
1042 ; IS__TUNIT____-SAME: (void (i32)* nocapture nofree [[FN:%.*]]) {
1043 ; IS__TUNIT____-NEXT: call void @callee_is_undef()
1044 ; IS__TUNIT____-NEXT: call void @unknown_calle_arg_is_undef(void (i32)* nocapture nofree [[FN]])
1045 ; IS__TUNIT____-NEXT: ret void
1047 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_callee_is_undef
1048 ; IS__CGSCC____-SAME: (void (i32)* nocapture nofree [[FN:%.*]]) {
1049 ; IS__CGSCC____-NEXT: unreachable
1051 call void @callee_is_undef(void ()* undef)
1052 call void @unknown_calle_arg_is_undef(void (i32)* %fn, i32 undef)
1055 define internal void @callee_is_undef(void ()* %fn) {
1057 ; IS__TUNIT____-LABEL: define {{[^@]+}}@callee_is_undef() {
1058 ; IS__TUNIT____-NEXT: call void undef()
1059 ; IS__TUNIT____-NEXT: ret void
1061 ; IS__CGSCC____-LABEL: define {{[^@]+}}@callee_is_undef
1062 ; IS__CGSCC____-SAME: (void ()* nocapture nofree noundef nonnull [[FN:%.*]]) {
1063 ; IS__CGSCC____-NEXT: call void [[FN]]()
1064 ; IS__CGSCC____-NEXT: ret void
1069 define internal void @unknown_calle_arg_is_undef(void (i32)* %fn, i32 %arg) {
1071 ; CHECK-LABEL: define {{[^@]+}}@unknown_calle_arg_is_undef
1072 ; CHECK-SAME: (void (i32)* nocapture nofree noundef nonnull [[FN:%.*]]) {
1073 ; CHECK-NEXT: call void [[FN]](i32 undef)
1074 ; CHECK-NEXT: ret void
1076 call void %fn(i32 %arg)
1083 @g = internal constant { [2 x i8*] } { [2 x i8*] [i8* bitcast (void (i8***)* @f1 to i8*), i8* bitcast (void (i1 (i8*)*)* @f2 to i8*)] }
1085 define internal void @f1(i8*** %a) {
1086 ; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
1087 ; IS__TUNIT____-LABEL: define {{[^@]+}}@f1
1088 ; IS__TUNIT____-SAME: (i8*** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR2]] {
1089 ; IS__TUNIT____-NEXT: entry:
1090 ; IS__TUNIT____-NEXT: [[X:%.*]] = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0
1091 ; IS__TUNIT____-NEXT: store i8** [[X]], i8*** [[A]], align 8
1092 ; IS__TUNIT____-NEXT: ret void
1094 ; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
1095 ; IS__CGSCC____-LABEL: define {{[^@]+}}@f1
1096 ; IS__CGSCC____-SAME: (i8*** nocapture nofree noundef nonnull writeonly align 8 dereferenceable(8) [[A:%.*]]) #[[ATTR2]] {
1097 ; IS__CGSCC____-NEXT: entry:
1098 ; IS__CGSCC____-NEXT: [[X:%.*]] = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0
1099 ; IS__CGSCC____-NEXT: store i8** [[X]], i8*** [[A]], align 8
1100 ; IS__CGSCC____-NEXT: ret void
1103 %x = getelementptr { [2 x i8*] }, { [2 x i8*] }* @g, i32 0, i32 0, i32 0
1104 store i8** %x , i8*** %a, align 8
1108 define internal void @f2(i1 (i8*)* %a) {
1109 ; CHECK-LABEL: define {{[^@]+}}@f2
1110 ; CHECK-SAME: (i1 (i8*)* [[A:%.*]]) {
1111 ; CHECK-NEXT: cont461:
1112 ; CHECK-NEXT: [[C1:%.*]] = bitcast i1 (i8*)* [[A]] to i8*
1113 ; CHECK-NEXT: call void @f3(i8* [[C1]], i1 (i8*)* nocapture nofree [[A]])
1114 ; CHECK-NEXT: ret void
1117 %c1 = bitcast i1 (i8*)* %a to i8*
1118 call void @f3(i8* %c1, i1 (i8*)* %a)
1122 define internal void @f3(i8* %a1, i1 (i8*)* %a) {
1123 ; CHECK-LABEL: define {{[^@]+}}@f3
1124 ; CHECK-SAME: (i8* [[A1:%.*]], i1 (i8*)* nocapture nofree [[A:%.*]]) {
1125 ; CHECK-NEXT: entry:
1126 ; CHECK-NEXT: [[CALL20:%.*]] = call i1 @f9()
1127 ; CHECK-NEXT: br i1 [[CALL20]], label [[LAND_LHS_TRUE:%.*]], label [[IF_END40:%.*]]
1128 ; CHECK: land.lhs.true:
1129 ; CHECK-NEXT: [[TMP0:%.*]] = call i1 [[A]](i8* [[A1]])
1130 ; CHECK-NEXT: br label [[IF_END40]]
1132 ; CHECK-NEXT: ret void
1135 %call20 = call i1 @f9()
1136 br i1 %call20, label %land.lhs.true, label %if.end40
1146 define linkonce_odr i1 @f9() {
1147 ; CHECK-LABEL: define {{[^@]+}}@f9() {
1148 ; CHECK-NEXT: entry:
1149 ; CHECK-NEXT: ret i1 false
1158 define i1 @test_cmp_null_after_cast() {
1159 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
1160 ; IS__TUNIT____-LABEL: define {{[^@]+}}@test_cmp_null_after_cast
1161 ; IS__TUNIT____-SAME: () #[[ATTR1]] {
1162 ; IS__TUNIT____-NEXT: ret i1 true
1164 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1165 ; IS__CGSCC____-LABEL: define {{[^@]+}}@test_cmp_null_after_cast
1166 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
1167 ; IS__CGSCC____-NEXT: ret i1 true
1169 %c = call i1 @cmp_null_after_cast(i32 0, i8 0)
1172 define internal i1 @cmp_null_after_cast(i32 %a, i8 %b) {
1173 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1174 ; IS__CGSCC____-LABEL: define {{[^@]+}}@cmp_null_after_cast
1175 ; IS__CGSCC____-SAME: () #[[ATTR1]] {
1176 ; IS__CGSCC____-NEXT: ret i1 undef
1178 %t = trunc i32 %a to i8
1179 %c = icmp eq i8 %t, %b
1186 define i32 @test(i1 %c) {
1187 ; CHECK-LABEL: define {{[^@]+}}@test
1188 ; CHECK-SAME: (i1 [[C:%.*]]) {
1189 ; CHECK-NEXT: [[R1:%.*]] = call i32 @ctx_test1(i1 [[C]])
1190 ; CHECK-NEXT: [[R2:%.*]] = call i32 @ctx_test2(i1 [[C]]), !range [[RNG0:![0-9]+]]
1191 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[R1]], [[R2]]
1192 ; CHECK-NEXT: ret i32 [[ADD]]
1194 %r1 = call i32 @ctx_test1(i1 %c)
1195 %r2 = call i32 @ctx_test2(i1 %c)
1196 %add = add i32 %r1, %r2
1200 define internal i32 @ctx_test1(i1 %c) {
1201 ; CHECK-LABEL: define {{[^@]+}}@ctx_test1
1202 ; CHECK-SAME: (i1 [[C:%.*]]) {
1203 ; CHECK-NEXT: entry:
1204 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[JOIN:%.*]]
1206 ; CHECK-NEXT: [[M:%.*]] = tail call i8* @m()
1207 ; CHECK-NEXT: [[I:%.*]] = ptrtoint i8* [[M]] to i64
1208 ; CHECK-NEXT: br label [[JOIN]]
1210 ; CHECK-NEXT: [[PHI:%.*]] = phi i64 [ [[I]], [[THEN]] ], [ undef, [[ENTRY:%.*]] ]
1211 ; CHECK-NEXT: [[RET:%.*]] = trunc i64 [[PHI]] to i32
1212 ; CHECK-NEXT: ret i32 [[RET]]
1215 br i1 %c, label %then, label %join
1218 %m = tail call i8* @m()
1219 %i = ptrtoint i8* %m to i64
1223 %phi = phi i64 [ %i, %then ], [ undef, %entry ]
1224 %ret = trunc i64 %phi to i32
1228 define internal i32 @ctx_test2(i1 %c) {
1229 ; CHECK-LABEL: define {{[^@]+}}@ctx_test2
1230 ; CHECK-SAME: (i1 [[C:%.*]]) {
1231 ; CHECK-NEXT: entry:
1232 ; CHECK-NEXT: br i1 [[C]], label [[THEN:%.*]], label [[JOIN:%.*]]
1234 ; CHECK-NEXT: [[M:%.*]] = tail call i8* @m()
1235 ; CHECK-NEXT: [[I:%.*]] = ptrtoint i8* [[M]] to i32
1236 ; CHECK-NEXT: br label [[JOIN]]
1238 ; CHECK-NEXT: [[PHI:%.*]] = phi i32 [ [[I]], [[THEN]] ], [ undef, [[ENTRY:%.*]] ]
1239 ; CHECK-NEXT: [[RET:%.*]] = lshr i32 [[PHI]], 1
1240 ; CHECK-NEXT: ret i32 [[RET]]
1243 br i1 %c, label %then, label %join
1246 %m = tail call i8* @m()
1247 %i = ptrtoint i8* %m to i32
1251 %phi = phi i32 [ %i, %then ], [ undef, %entry ]
1252 %ret = lshr i32 %phi, 1
1255 uselistorder label %join, { 1, 0 }
1259 ; IS__TUNIT_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1260 ; IS__TUNIT_OPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
1261 ; IS__TUNIT_OPM: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn writeonly }
1262 ; IS__TUNIT_OPM: attributes #[[ATTR3]] = { argmemonly nofree nosync nounwind writeonly }
1263 ; IS__TUNIT_OPM: attributes #[[ATTR4]] = { nofree nosync nounwind willreturn writeonly }
1264 ; IS__TUNIT_OPM: attributes #[[ATTR5]] = { willreturn }
1266 ; IS__TUNIT_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1267 ; IS__TUNIT_NPM: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn }
1268 ; IS__TUNIT_NPM: attributes #[[ATTR2]] = { argmemonly nofree nosync nounwind willreturn writeonly }
1269 ; IS__TUNIT_NPM: attributes #[[ATTR3]] = { nofree nosync nounwind willreturn writeonly }
1270 ; IS__TUNIT_NPM: attributes #[[ATTR4]] = { willreturn }
1272 ; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1273 ; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
1274 ; IS__CGSCC_OPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
1275 ; IS__CGSCC_OPM: attributes #[[ATTR3]] = { argmemonly nofree norecurse nosync nounwind writeonly }
1276 ; IS__CGSCC_OPM: attributes #[[ATTR4]] = { nofree norecurse nosync nounwind willreturn writeonly }
1277 ; IS__CGSCC_OPM: attributes #[[ATTR5]] = { willreturn }
1279 ; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
1280 ; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
1281 ; IS__CGSCC_NPM: attributes #[[ATTR2]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly }
1282 ; IS__CGSCC_NPM: attributes #[[ATTR3]] = { nofree norecurse nosync nounwind willreturn writeonly }
1283 ; IS__CGSCC_NPM: attributes #[[ATTR4]] = { willreturn }
1285 ; CHECK: [[RNG0]] = !{i32 0, i32 -2147483648}