• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=39 -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=39 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4; TODO: The old pass manager cgscc run is disabled as it causes a crash on windows which is under investigation: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/23151
5; 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
6; 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
8; NOT_CGSCC_OPM: @dead_with_blockaddress_users.l = constant [2 x i8*] [i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 1 to i8*)]
9; IS__CGSCC_OPM: @dead_with_blockaddress_users.l = constant [2 x i8*] [i8* blockaddress(@dead_with_blockaddress_users, %lab0), i8* blockaddress(@dead_with_blockaddress_users, %end)]
10@dead_with_blockaddress_users.l = constant [2 x i8*] [i8* blockaddress(@dead_with_blockaddress_users, %lab0), i8* blockaddress(@dead_with_blockaddress_users, %end)]
11
12declare void @no_return_call() nofree noreturn nounwind nosync
13
14declare void @normal_call() readnone
15
16declare i32 @foo()
17
18declare i32 @foo_nounwind() nounwind
19
20declare i32 @foo_noreturn_nounwind() noreturn nounwind
21
22declare i32 @foo_noreturn() noreturn
23
24declare i32 @bar() nosync readnone
25
26; This internal function has no live call sites, so all its BBs are considered dead,
27; and nothing should be deduced for it.
28
29define internal i32 @dead_internal_func(i32 %0) {
30; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
31; IS__CGSCC____-LABEL: define {{[^@]+}}@dead_internal_func
32; IS__CGSCC____-SAME: () [[ATTR6:#.*]] {
33; IS__CGSCC____-NEXT:    br label [[TMP2:%.*]]
34; IS__CGSCC____:       1:
35; IS__CGSCC____-NEXT:    ret i32 undef
36; IS__CGSCC____:       2:
37; IS__CGSCC____-NEXT:    [[TMP3:%.*]] = phi i32 [ [[TMP6:%.*]], [[TMP2]] ], [ 1, [[TMP0:%.*]] ]
38; IS__CGSCC____-NEXT:    [[TMP4:%.*]] = phi i32 [ [[TMP5:%.*]], [[TMP2]] ], [ 1, [[TMP0]] ]
39; IS__CGSCC____-NEXT:    [[TMP5]] = mul nsw i32 [[TMP3]], [[TMP4]]
40; IS__CGSCC____-NEXT:    [[TMP6]] = add nuw nsw i32 [[TMP3]], 1
41; IS__CGSCC____-NEXT:    [[TMP7:%.*]] = icmp eq i32 [[TMP3]], 10
42; IS__CGSCC____-NEXT:    br i1 [[TMP7]], label [[TMP1:%.*]], label [[TMP2]]
43;
44  %2 = icmp slt i32 %0, 1
45  br i1 %2, label %3, label %5
46
47; <label>:3:                                      ; preds = %5, %1
48  %4 = phi i32 [ 1, %1 ], [ %8, %5 ]
49  ret i32 %4
50
51; <label>:5:                                      ; preds = %1, %5
52  %6 = phi i32 [ %9, %5 ], [ 1, %1 ]
53  %7 = phi i32 [ %8, %5 ], [ 1, %1 ]
54  %8 = mul nsw i32 %6, %7
55  %9 = add nuw nsw i32 %6, 1
56  %10 = icmp eq i32 %6, %0
57  br i1 %10, label %3, label %5
58}
59
60define i32 @volatile_load(i32*) norecurse nounwind uwtable {
61; CHECK: Function Attrs: argmemonly nofree norecurse nounwind uwtable willreturn
62; CHECK-LABEL: define {{[^@]+}}@volatile_load
63; CHECK-SAME: (i32* nofree align 4 [[TMP0:%.*]]) [[ATTR7:#.*]] {
64; CHECK-NEXT:    [[TMP2:%.*]] = load volatile i32, i32* [[TMP0]], align 4
65; CHECK-NEXT:    ret i32 [[TMP2]]
66;
67  %2 = load volatile i32, i32* %0, align 4
68  ret i32 %2
69}
70
71define internal i32 @internal_load(i32*) norecurse nounwind uwtable {
72; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone uwtable willreturn
73; IS__CGSCC____-LABEL: define {{[^@]+}}@internal_load
74; IS__CGSCC____-SAME: () [[ATTR8:#.*]] {
75; IS__CGSCC____-NEXT:    ret i32 undef
76;
77  %2 = load i32, i32* %0, align 4
78  ret i32 %2
79}
80; TEST 1: Only first block is live.
81
82define i32 @first_block_no_return(i32 %a, i32* nonnull %ptr1, i32* %ptr2) #0 {
83; CHECK: Function Attrs: nofree noreturn nosync nounwind
84; CHECK-LABEL: define {{[^@]+}}@first_block_no_return
85; CHECK-SAME: (i32 [[A:%.*]], i32* nocapture nofree nonnull readnone [[PTR1:%.*]], i32* nocapture nofree readnone [[PTR2:%.*]]) [[ATTR0:#.*]] {
86; CHECK-NEXT:  entry:
87; CHECK-NEXT:    call void @no_return_call() [[ATTR3:#.*]]
88; CHECK-NEXT:    unreachable
89; CHECK:       cond.true:
90; CHECK-NEXT:    unreachable
91; CHECK:       cond.false:
92; CHECK-NEXT:    unreachable
93; CHECK:       cond.end:
94; CHECK-NEXT:    unreachable
95;
96entry:
97  call i32 @internal_load(i32* %ptr1)
98  call void @no_return_call()
99  call i32 @dead_internal_func(i32 10)
100  %cmp = icmp eq i32 %a, 0
101  br i1 %cmp, label %cond.true, label %cond.false
102
103cond.true:                                        ; preds = %entry
104  call i32 @internal_load(i32* %ptr2)
105  %load = call i32 @volatile_load(i32* %ptr1)
106  call void @normal_call()
107  %call = call i32 @foo()
108  br label %cond.end
109
110cond.false:                                       ; preds = %entry
111  call void @normal_call()
112  %call1 = call i32 @bar()
113  br label %cond.end
114
115cond.end:                                         ; preds = %cond.false, %cond.true
116  %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]
117  ret i32 %cond
118}
119
120; TEST 2: cond.true is dead, but cond.end is not, since cond.false is live
121
122; This is just an example. For example we can put a sync call in a
123; dead block and check if it is deduced.
124
125define i32 @dead_block_present(i32 %a, i32* %ptr1) #0 {
126; CHECK: Function Attrs: nosync
127; CHECK-LABEL: define {{[^@]+}}@dead_block_present
128; CHECK-SAME: (i32 [[A:%.*]], i32* nocapture nofree readnone [[PTR1:%.*]]) [[ATTR9:#.*]] {
129; CHECK-NEXT:  entry:
130; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
131; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
132; CHECK:       cond.true:
133; CHECK-NEXT:    call void @no_return_call() [[ATTR3]]
134; CHECK-NEXT:    unreachable
135; CHECK:       cond.false:
136; CHECK-NEXT:    call void @normal_call()
137; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
138; CHECK-NEXT:    br label [[COND_END:%.*]]
139; CHECK:       cond.end:
140; CHECK-NEXT:    ret i32 [[CALL1]]
141;
142entry:
143  %cmp = icmp eq i32 %a, 0
144  br i1 %cmp, label %cond.true, label %cond.false
145
146cond.true:                                        ; preds = %entry
147  call void @no_return_call()
148  %call = call i32 @volatile_load(i32* %ptr1)
149  br label %cond.end
150
151cond.false:                                       ; preds = %entry
152  call void @normal_call()
153  %call1 = call i32 @bar()
154  br label %cond.end
155
156cond.end:                                         ; preds = %cond.false, %cond.true
157  %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]
158  ret i32 %cond
159}
160
161; TEST 3: both cond.true and cond.false are dead, therfore cond.end is dead as well.
162
163define i32 @all_dead(i32 %a) #0 {
164; CHECK: Function Attrs: nofree noreturn nosync nounwind
165; CHECK-LABEL: define {{[^@]+}}@all_dead
166; CHECK-SAME: (i32 [[A:%.*]]) [[ATTR0]] {
167; CHECK-NEXT:  entry:
168; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
169; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
170; CHECK:       cond.true:
171; CHECK-NEXT:    call void @no_return_call() [[ATTR3]]
172; CHECK-NEXT:    unreachable
173; CHECK:       cond.false:
174; CHECK-NEXT:    call void @no_return_call() [[ATTR3]]
175; CHECK-NEXT:    unreachable
176; CHECK:       cond.end:
177; CHECK-NEXT:    unreachable
178;
179entry:
180  %cmp = icmp eq i32 %a, 0
181  br i1 %cmp, label %cond.true, label %cond.false
182
183cond.true:                                        ; preds = %entry
184  call void @no_return_call()
185  call i32 @dead_internal_func(i32 10)
186  %call = call i32 @foo()
187  br label %cond.end
188
189cond.false:                                       ; preds = %entry
190  call void @no_return_call()
191  call i32 @dead_internal_func(i32 10)
192  %call1 = call i32 @bar()
193  br label %cond.end
194
195cond.end:                                         ; preds = %cond.false, %cond.true
196  %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]
197  ret i32 %cond
198}
199
200declare i32 @__gxx_personality_v0(...)
201
202; TEST 4: All blocks are live.
203
204define i32 @all_live(i32 %a) #0 {
205; CHECK-LABEL: define {{[^@]+}}@all_live
206; CHECK-SAME: (i32 [[A:%.*]]) {
207; CHECK-NEXT:  entry:
208; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
209; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
210; CHECK:       cond.true:
211; CHECK-NEXT:    call void @normal_call()
212; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo_noreturn() [[ATTR4:#.*]]
213; CHECK-NEXT:    unreachable
214; CHECK:       cond.false:
215; CHECK-NEXT:    call void @normal_call()
216; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
217; CHECK-NEXT:    br label [[COND_END:%.*]]
218; CHECK:       cond.end:
219; CHECK-NEXT:    ret i32 [[CALL1]]
220;
221entry:
222  %cmp = icmp eq i32 %a, 0
223  br i1 %cmp, label %cond.true, label %cond.false
224
225cond.true:                                        ; preds = %entry
226  call void @normal_call()
227  %call = call i32 @foo_noreturn()
228  br label %cond.end
229
230cond.false:                                       ; preds = %entry
231  call void @normal_call()
232  %call1 = call i32 @bar()
233  br label %cond.end
234
235cond.end:                                         ; preds = %cond.false, %cond.true
236  %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]
237  ret i32 %cond
238}
239
240; TEST 5.1 noreturn invoke instruction with a unreachable normal successor block.
241
242define i32 @invoke_noreturn(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
243; CHECK-LABEL: define {{[^@]+}}@invoke_noreturn
244; CHECK-SAME: (i32 [[A:%.*]]) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
245; CHECK-NEXT:  entry:
246; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
247; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
248; CHECK:       cond.true:
249; CHECK-NEXT:    call void @normal_call()
250; CHECK-NEXT:    [[CALL:%.*]] = invoke i32 @foo_noreturn() [[ATTR4]]
251; CHECK-NEXT:    to label [[CONTINUE:%.*]] unwind label [[CLEANUP:%.*]]
252; CHECK:       cond.false:
253; CHECK-NEXT:    call void @normal_call()
254; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
255; CHECK-NEXT:    br label [[COND_END:%.*]]
256; CHECK:       cond.end:
257; CHECK-NEXT:    ret i32 [[CALL1]]
258; CHECK:       continue:
259; CHECK-NEXT:    unreachable
260; CHECK:       cleanup:
261; CHECK-NEXT:    [[RES:%.*]] = landingpad { i8*, i32 }
262; CHECK-NEXT:    catch i8* null
263; CHECK-NEXT:    ret i32 0
264;
265entry:
266  %cmp = icmp eq i32 %a, 0
267  br i1 %cmp, label %cond.true, label %cond.false
268
269cond.true:                                        ; preds = %entry
270  call void @normal_call()
271  %call = invoke i32 @foo_noreturn() to label %continue
272  unwind label %cleanup
273
274cond.false:                                       ; preds = %entry
275  call void @normal_call()
276  %call1 = call i32 @bar()
277  br label %cond.end
278
279cond.end:                                         ; preds = %cond.false, %continue
280  %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ]
281  ret i32 %cond
282
283continue:
284  br label %cond.end
285
286cleanup:
287  %res = landingpad { i8*, i32 }
288  catch i8* null
289  ret i32 0
290}
291
292; TEST 5.2 noreturn invoke instruction replaced by a call and an unreachable instruction
293; put after it.
294
295define i32 @invoke_noreturn_nounwind(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
296; CHECK-LABEL: define {{[^@]+}}@invoke_noreturn_nounwind
297; CHECK-SAME: (i32 [[A:%.*]]) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
298; CHECK-NEXT:  entry:
299; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
300; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
301; CHECK:       cond.true:
302; CHECK-NEXT:    call void @normal_call()
303; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo_noreturn_nounwind() [[ATTR3]]
304; CHECK-NEXT:    unreachable
305; CHECK:       cond.false:
306; CHECK-NEXT:    call void @normal_call()
307; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
308; CHECK-NEXT:    br label [[COND_END:%.*]]
309; CHECK:       cond.end:
310; CHECK-NEXT:    ret i32 [[CALL1]]
311; CHECK:       continue:
312; CHECK-NEXT:    unreachable
313; CHECK:       cleanup:
314; CHECK-NEXT:    unreachable
315;
316entry:
317  %cmp = icmp eq i32 %a, 0
318  br i1 %cmp, label %cond.true, label %cond.false
319
320cond.true:                                        ; preds = %entry
321  call void @normal_call()
322  %call = invoke i32 @foo_noreturn_nounwind() to label %continue
323  unwind label %cleanup
324
325
326cond.false:                                       ; preds = %entry
327  call void @normal_call()
328  %call1 = call i32 @bar()
329  br label %cond.end
330
331cond.end:                                         ; preds = %cond.false, %continue
332  %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ]
333  ret i32 %cond
334
335continue:
336  br label %cond.end
337
338cleanup:
339  %res = landingpad { i8*, i32 }
340  catch i8* null
341  ret i32 0
342}
343
344; TEST 5.3 unounwind invoke instruction replaced by a call and a branch instruction put after it.
345define i32 @invoke_nounwind(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
346; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind
347; CHECK-SAME: (i32 [[A:%.*]]) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
348; CHECK-NEXT:  entry:
349; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
350; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
351; CHECK:       cond.true:
352; CHECK-NEXT:    call void @normal_call()
353; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo_nounwind() [[ATTR2:#.*]]
354; CHECK-NEXT:    br label [[CONTINUE:%.*]]
355; CHECK:       cond.false:
356; CHECK-NEXT:    call void @normal_call()
357; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
358; CHECK-NEXT:    br label [[COND_END:%.*]]
359; CHECK:       cond.end:
360; CHECK-NEXT:    [[COND:%.*]] = phi i32 [ [[CALL]], [[CONTINUE]] ], [ [[CALL1]], [[COND_FALSE]] ]
361; CHECK-NEXT:    ret i32 [[COND]]
362; CHECK:       continue:
363; CHECK-NEXT:    br label [[COND_END]]
364; CHECK:       cleanup:
365; CHECK-NEXT:    unreachable
366;
367entry:
368  %cmp = icmp eq i32 %a, 0
369  br i1 %cmp, label %cond.true, label %cond.false
370
371cond.true:                                        ; preds = %entry
372  call void @normal_call()
373  %call = invoke i32 @foo_nounwind() to label %continue
374  unwind label %cleanup
375
376cond.false:                                       ; preds = %entry
377  call void @normal_call()
378  %call1 = call i32 @bar()
379  br label %cond.end
380
381cond.end:                                         ; preds = %cond.false, %continue
382  %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ]
383  ret i32 %cond
384
385continue:
386  br label %cond.end
387
388cleanup:
389  %res = landingpad { i8*, i32 }
390  catch i8* null
391  ret i32 0
392}
393
394; TEST 5.4 unounwind invoke instruction replaced by a call and a branch instruction put after it.
395define i32 @invoke_nounwind_phi(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
396; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind_phi
397; CHECK-SAME: (i32 [[A:%.*]]) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
398; CHECK-NEXT:  entry:
399; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
400; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
401; CHECK:       cond.true:
402; CHECK-NEXT:    call void @normal_call()
403; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo_nounwind() [[ATTR2]]
404; CHECK-NEXT:    br label [[CONTINUE:%.*]]
405; CHECK:       cond.false:
406; CHECK-NEXT:    call void @normal_call()
407; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
408; CHECK-NEXT:    br label [[CONTINUE]]
409; CHECK:       continue:
410; CHECK-NEXT:    [[P:%.*]] = phi i32 [ 0, [[COND_TRUE]] ], [ 1, [[COND_FALSE]] ]
411; CHECK-NEXT:    ret i32 [[P]]
412; CHECK:       cleanup:
413; CHECK-NEXT:    unreachable
414;
415entry:
416  %cmp = icmp eq i32 %a, 0
417  br i1 %cmp, label %cond.true, label %cond.false
418
419cond.true:                                        ; preds = %entry
420  call void @normal_call()
421  %call = invoke i32 @foo_nounwind() to label %continue
422  unwind label %cleanup
423
424cond.false:                                       ; preds = %entry
425  call void @normal_call()
426  %call1 = call i32 @bar()
427  br label %continue
428
429continue:
430  %p = phi i32 [ 0, %cond.true ], [ 1, %cond.false ]
431  ret i32 %p
432
433cleanup:
434  %res = landingpad { i8*, i32 } catch i8* null
435  ret i32 0
436}
437
438; TEST 5.5 unounwind invoke instruction replaced by a call and a branch instruction put after it.
439define i32 @invoke_nounwind_phi_dom(i32 %a) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
440; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind_phi_dom
441; CHECK-SAME: (i32 [[A:%.*]]) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
442; CHECK-NEXT:  entry:
443; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i32 [[A]], 0
444; CHECK-NEXT:    br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]
445; CHECK:       cond.true:
446; CHECK-NEXT:    call void @normal_call()
447; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo_nounwind() [[ATTR2]]
448; CHECK-NEXT:    br label [[CONTINUE:%.*]]
449; CHECK:       cond.false:
450; CHECK-NEXT:    call void @normal_call()
451; CHECK-NEXT:    [[CALL1:%.*]] = call i32 @bar()
452; CHECK-NEXT:    br label [[CONTINUE]]
453; CHECK:       continue:
454; CHECK-NEXT:    [[P:%.*]] = phi i32 [ [[CALL]], [[COND_TRUE]] ], [ [[CALL1]], [[COND_FALSE]] ]
455; CHECK-NEXT:    ret i32 [[P]]
456; CHECK:       cleanup:
457; CHECK-NEXT:    unreachable
458;
459entry:
460  %cmp = icmp eq i32 %a, 0
461  br i1 %cmp, label %cond.true, label %cond.false
462
463cond.true:                                        ; preds = %entry
464  call void @normal_call()
465  %call = invoke i32 @foo_nounwind() to label %continue
466  unwind label %cleanup
467
468cond.false:                                       ; preds = %entry
469  call void @normal_call()
470  %call1 = call i32 @bar()
471  br label %continue
472
473continue:
474  %p = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]
475  ret i32 %p
476
477cleanup:
478  %res = landingpad { i8*, i32 } catch i8* null
479  ret i32 0
480}
481
482; TEST 6: Undefined behvior, taken from LangRef.
483; FIXME: Should be able to detect undefined behavior.
484
485define void @ub(i32* %0) {
486; NOT_CGSCC_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly
487; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@ub
488; NOT_CGSCC_NPM-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) [[ATTR8:#.*]] {
489; NOT_CGSCC_NPM-NEXT:    [[POISON:%.*]] = sub nuw i32 0, 1
490; NOT_CGSCC_NPM-NEXT:    [[STILL_POISON:%.*]] = and i32 [[POISON]], 0
491; NOT_CGSCC_NPM-NEXT:    [[POISON_YET_AGAIN:%.*]] = getelementptr i32, i32* [[TMP0]], i32 [[STILL_POISON]]
492; NOT_CGSCC_NPM-NEXT:    store i32 0, i32* [[POISON_YET_AGAIN]], align 4
493; NOT_CGSCC_NPM-NEXT:    ret void
494;
495; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly
496; IS__CGSCC____-LABEL: define {{[^@]+}}@ub
497; IS__CGSCC____-SAME: (i32* nocapture nofree writeonly [[TMP0:%.*]]) [[ATTR10:#.*]] {
498; IS__CGSCC____-NEXT:    [[POISON:%.*]] = sub nuw i32 0, 1
499; IS__CGSCC____-NEXT:    [[STILL_POISON:%.*]] = and i32 [[POISON]], 0
500; IS__CGSCC____-NEXT:    [[POISON_YET_AGAIN:%.*]] = getelementptr i32, i32* [[TMP0]], i32 [[STILL_POISON]]
501; IS__CGSCC____-NEXT:    store i32 0, i32* [[POISON_YET_AGAIN]], align 4
502; IS__CGSCC____-NEXT:    ret void
503;
504  %poison = sub nuw i32 0, 1           ; Results in a poison value.
505  %still_poison = and i32 %poison, 0   ; 0, but also poison.
506  %poison_yet_again = getelementptr i32, i32* %0, i32 %still_poison
507  store i32 0, i32* %poison_yet_again  ; Undefined behavior due to store to poison.
508  ret void
509}
510
511define void @inf_loop() #0 {
512; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone
513; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@inf_loop
514; NOT_CGSCC_NPM-SAME: () [[ATTR9:#.*]] {
515; NOT_CGSCC_NPM-NEXT:  entry:
516; NOT_CGSCC_NPM-NEXT:    br label [[WHILE_BODY:%.*]]
517; NOT_CGSCC_NPM:       while.body:
518; NOT_CGSCC_NPM-NEXT:    br label [[WHILE_BODY]]
519;
520; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone
521; IS__CGSCC____-LABEL: define {{[^@]+}}@inf_loop
522; IS__CGSCC____-SAME: () [[ATTR11:#.*]] {
523; IS__CGSCC____-NEXT:  entry:
524; IS__CGSCC____-NEXT:    br label [[WHILE_BODY:%.*]]
525; IS__CGSCC____:       while.body:
526; IS__CGSCC____-NEXT:    br label [[WHILE_BODY]]
527;
528entry:
529  br label %while.body
530
531while.body:                                       ; preds = %entry, %while.body
532  br label %while.body
533}
534
535; TEST 7: Infinite loop.
536; FIXME: Detect infloops, and mark affected blocks dead.
537
538define i32 @test5(i32, i32) #0 {
539; CHECK: Function Attrs: nosync readnone
540; CHECK-LABEL: define {{[^@]+}}@test5
541; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) [[ATTR5:#.*]] {
542; CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]
543; CHECK-NEXT:    br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]
544; CHECK:       cond.if:
545; CHECK-NEXT:    [[TMP4:%.*]] = tail call i32 @bar()
546; CHECK-NEXT:    br label [[COND_END:%.*]]
547; CHECK:       cond.elseif:
548; CHECK-NEXT:    unreachable
549; CHECK:       cond.else:
550; CHECK-NEXT:    unreachable
551; CHECK:       cond.end:
552; CHECK-NEXT:    ret i32 0
553;
554  %3 = icmp sgt i32 %0, %1
555  br i1 %3, label %cond.if, label %cond.elseif
556
557cond.if:                                                ; preds = %2
558  %4 = tail call i32 @bar()
559  br label %cond.end
560
561cond.elseif:                                                ; preds = %2
562  call void @inf_loop()
563  %5 = icmp slt i32 %0, %1
564  br i1 %5, label %cond.end, label %cond.else
565
566cond.else:                                                ; preds = %cond.elseif
567  %6 = tail call i32 @foo()
568  br label %cond.end
569
570cond.end:                                               ; preds = %cond.if, %cond.else, %cond.elseif
571  %7 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ]
572  ret i32 %7
573}
574
575define void @rec() #0 {
576; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
577; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@rec
578; NOT_CGSCC_NPM-SAME: () [[ATTR10:#.*]] {
579; NOT_CGSCC_NPM-NEXT:  entry:
580; NOT_CGSCC_NPM-NEXT:    unreachable
581;
582; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
583; IS__CGSCC____-LABEL: define {{[^@]+}}@rec
584; IS__CGSCC____-SAME: () [[ATTR12:#.*]] {
585; IS__CGSCC____-NEXT:  entry:
586; IS__CGSCC____-NEXT:    unreachable
587;
588entry:
589  call void @rec()
590  ret void
591}
592
593; TEST 8: Recursion
594; FIXME: everything after first block should be marked dead
595; and unreachable should be put after call to @rec().
596
597define i32 @test6(i32, i32) #0 {
598; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind readnone willreturn
599; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test6
600; NOT_CGSCC_NPM-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) [[ATTR10]] {
601; NOT_CGSCC_NPM-NEXT:    unreachable
602; NOT_CGSCC_NPM:       cond.if:
603; NOT_CGSCC_NPM-NEXT:    unreachable
604; NOT_CGSCC_NPM:       cond.elseif:
605; NOT_CGSCC_NPM-NEXT:    unreachable
606; NOT_CGSCC_NPM:       cond.else:
607; NOT_CGSCC_NPM-NEXT:    unreachable
608; NOT_CGSCC_NPM:       cond.end:
609; NOT_CGSCC_NPM-NEXT:    unreachable
610;
611; IS__CGSCC____: Function Attrs: nofree norecurse noreturn nosync nounwind readnone willreturn
612; IS__CGSCC____-LABEL: define {{[^@]+}}@test6
613; IS__CGSCC____-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) [[ATTR12]] {
614; IS__CGSCC____-NEXT:    unreachable
615; IS__CGSCC____:       cond.if:
616; IS__CGSCC____-NEXT:    unreachable
617; IS__CGSCC____:       cond.elseif:
618; IS__CGSCC____-NEXT:    unreachable
619; IS__CGSCC____:       cond.else:
620; IS__CGSCC____-NEXT:    unreachable
621; IS__CGSCC____:       cond.end:
622; IS__CGSCC____-NEXT:    unreachable
623;
624  call void @rec()
625  %3 = icmp sgt i32 %0, %1
626  br i1 %3, label %cond.if, label %cond.elseif
627
628cond.if:                                                ; preds = %2
629  %4 = tail call i32 @bar()
630  br label %cond.end
631
632cond.elseif:                                                ; preds = %2
633  call void @rec()
634  %5 = icmp slt i32 %0, %1
635  br i1 %5, label %cond.end, label %cond.else
636
637cond.else:                                                ; preds = %cond.elseif
638  %6 = tail call i32 @foo()
639  br label %cond.end
640
641cond.end:                                               ; preds = %cond.if, %cond.else, %cond.elseif
642  %7 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ]
643  ret i32 %7
644}
645; TEST 9: Recursion
646; FIXME: contains recursive call to itself in cond.elseif block
647
648define i32 @test7(i32, i32) #0 {
649; CHECK-LABEL: define {{[^@]+}}@test7
650; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {
651; CHECK-NEXT:    [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]
652; CHECK-NEXT:    br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]
653; CHECK:       cond.if:
654; CHECK-NEXT:    [[TMP4:%.*]] = tail call i32 @bar()
655; CHECK-NEXT:    br label [[COND_END:%.*]]
656; CHECK:       cond.elseif:
657; CHECK-NEXT:    [[TMP5:%.*]] = tail call i32 @test7(i32 [[TMP0]], i32 [[TMP1]])
658; CHECK-NEXT:    [[TMP6:%.*]] = icmp slt i32 [[TMP0]], [[TMP1]]
659; CHECK-NEXT:    br i1 [[TMP6]], label [[COND_END]], label [[COND_ELSE:%.*]]
660; CHECK:       cond.else:
661; CHECK-NEXT:    [[TMP7:%.*]] = tail call i32 @foo()
662; CHECK-NEXT:    br label [[COND_END]]
663; CHECK:       cond.end:
664; CHECK-NEXT:    [[TMP8:%.*]] = phi i32 [ [[TMP1]], [[COND_ELSEIF]] ], [ 0, [[COND_ELSE]] ], [ 0, [[COND_IF]] ]
665; CHECK-NEXT:    ret i32 [[TMP8]]
666;
667  %3 = icmp sgt i32 %0, %1
668  br i1 %3, label %cond.if, label %cond.elseif
669
670cond.if:                                                ; preds = %2
671  %4 = tail call i32 @bar()
672  br label %cond.end
673
674cond.elseif:                                                ; preds = %2
675  %5 = tail call i32 @test7(i32 %0, i32 %1)
676  %6 = icmp slt i32 %0, %1
677  br i1 %6, label %cond.end, label %cond.else
678
679cond.else:                                                ; preds = %cond.elseif
680  %7 = tail call i32 @foo()
681  br label %cond.end
682
683cond.end:                                               ; preds = %cond.if, %cond.else, %cond.elseif
684  %8 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ]
685  ret i32 %8
686}
687
688; SCC test
689;
690; char a1 __attribute__((aligned(8)));
691; char a2 __attribute__((aligned(16)));
692;
693; char* f1(char* a ){
694;     return a?a:f2(&a1);
695; }
696; char* f2(char* a){
697;     return a?f1(a):f3(&a2);
698; }
699;
700; char* f3(char* a){
701;     return a?&a1: f1(&a2);
702; }
703
704@a1 = common global i8 0, align 8
705@a2 = common global i8 0, align 16
706
707define internal i8* @f1(i8* readnone %0) local_unnamed_addr #0 {
708; IS__CGSCC____-LABEL: define {{[^@]+}}@f1
709; IS__CGSCC____-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr {
710; IS__CGSCC____-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
711; IS__CGSCC____-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]
712; IS__CGSCC____:       3:
713; IS__CGSCC____-NEXT:    [[TMP4:%.*]] = tail call i8* @f2(i8* nonnull @a1)
714; IS__CGSCC____-NEXT:    br label [[TMP5]]
715; IS__CGSCC____:       5:
716; IS__CGSCC____-NEXT:    [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP0]], [[TMP1:%.*]] ]
717; IS__CGSCC____-NEXT:    ret i8* [[TMP6]]
718;
719  %2 = icmp eq i8* %0, null
720  br i1 %2, label %3, label %5
721
722; <label>:3:                                      ; preds = %1
723  %4 = tail call i8* @f2(i8* nonnull @a1)
724  br label %5
725
726; <label>:5:                                      ; preds = %1, %3
727  %6 = phi i8* [ %4, %3 ], [ %0, %1 ]
728  ret i8* %6
729}
730
731define internal i8* @f2(i8* readnone %0) local_unnamed_addr #0 {
732; IS__CGSCC____-LABEL: define {{[^@]+}}@f2
733; IS__CGSCC____-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr {
734; IS__CGSCC____-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
735; IS__CGSCC____-NEXT:    br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]
736; IS__CGSCC____:       3:
737; IS__CGSCC____-NEXT:    [[TMP4:%.*]] = tail call i8* @f1(i8* nonnull [[TMP0]])
738; IS__CGSCC____-NEXT:    br label [[TMP7:%.*]]
739; IS__CGSCC____:       5:
740; IS__CGSCC____-NEXT:    [[TMP6:%.*]] = tail call i8* @f3(i8* nonnull @a2)
741; IS__CGSCC____-NEXT:    br label [[TMP7]]
742; IS__CGSCC____:       7:
743; IS__CGSCC____-NEXT:    [[TMP8:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ]
744; IS__CGSCC____-NEXT:    ret i8* [[TMP8]]
745;
746  %2 = icmp eq i8* %0, null
747  br i1 %2, label %5, label %3
748
749; <label>:3:                                      ; preds = %1
750
751  %4 = tail call i8* @f1(i8* nonnull %0)
752  br label %7
753
754; <label>:5:                                      ; preds = %1
755  %6 = tail call i8* @f3(i8* nonnull @a2)
756  br label %7
757
758; <label>:7:                                      ; preds = %5, %3
759  %8 = phi i8* [ %4, %3 ], [ %6, %5 ]
760  ret i8* %8
761}
762
763define internal i8* @f3(i8* readnone %0) local_unnamed_addr #0 {
764; IS__CGSCC____-LABEL: define {{[^@]+}}@f3
765; IS__CGSCC____-SAME: (i8* readnone [[TMP0:%.*]]) local_unnamed_addr {
766; IS__CGSCC____-NEXT:    [[TMP2:%.*]] = icmp eq i8* [[TMP0]], null
767; IS__CGSCC____-NEXT:    br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]
768; IS__CGSCC____:       3:
769; IS__CGSCC____-NEXT:    [[TMP4:%.*]] = tail call i8* @f1(i8* nonnull @a2)
770; IS__CGSCC____-NEXT:    br label [[TMP5]]
771; IS__CGSCC____:       5:
772; IS__CGSCC____-NEXT:    [[TMP6:%.*]] = phi i8* [ [[TMP4]], [[TMP3]] ], [ @a1, [[TMP1:%.*]] ]
773; IS__CGSCC____-NEXT:    ret i8* [[TMP6]]
774;
775  %2 = icmp eq i8* %0, null
776  br i1 %2, label %3, label %5
777
778; <label>:3:                                      ; preds = %1
779  %4 = tail call i8* @f1(i8* nonnull @a2)
780  br label %5
781
782; <label>:5:                                      ; preds = %1, %3
783  %6 = phi i8* [ %4, %3 ], [ @a1, %1 ]
784  ret i8* %6
785}
786
787declare void @sink() nofree nosync nounwind willreturn
788define void @test_unreachable() {
789; NOT_CGSCC_NPM: Function Attrs: nofree noreturn nosync nounwind
790; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@test_unreachable
791; NOT_CGSCC_NPM-SAME: () [[ATTR0:#.*]] {
792; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14:#.*]]
793; NOT_CGSCC_NPM-NEXT:    call void @test_unreachable() [[ATTR0]]
794; NOT_CGSCC_NPM-NEXT:    unreachable
795;
796; IS__CGSCC____: Function Attrs: nofree noreturn nosync nounwind
797; IS__CGSCC____-LABEL: define {{[^@]+}}@test_unreachable
798; IS__CGSCC____-SAME: () [[ATTR0:#.*]] {
799; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16:#.*]]
800; IS__CGSCC____-NEXT:    call void @test_unreachable() [[ATTR0]]
801; IS__CGSCC____-NEXT:    unreachable
802;
803  call void @sink()
804  call void @test_unreachable()
805  unreachable
806}
807
808define linkonce_odr void @non_exact1() {
809; CHECK-LABEL: define {{[^@]+}}@non_exact1() {
810; CHECK-NEXT:    call void @non_dead_a0() [[ATTR2]]
811; CHECK-NEXT:    call void @non_dead_a1() [[ATTR2]]
812; CHECK-NEXT:    call void @non_dead_a2() [[ATTR2]]
813; CHECK-NEXT:    call void @non_dead_a3() [[ATTR2]]
814; CHECK-NEXT:    call void @non_dead_a4() [[ATTR2]]
815; CHECK-NEXT:    call void @non_dead_a5() [[ATTR2]]
816; CHECK-NEXT:    call void @non_dead_a6() [[ATTR2]]
817; CHECK-NEXT:    call void @non_dead_a7() [[ATTR2]]
818; CHECK-NEXT:    call void @non_dead_a8() [[ATTR2]]
819; CHECK-NEXT:    call void @non_dead_a9() [[ATTR2]]
820; CHECK-NEXT:    call void @non_dead_a10() [[ATTR2]]
821; CHECK-NEXT:    call void @non_dead_a11() [[ATTR2]]
822; CHECK-NEXT:    call void @non_dead_a12() [[ATTR2]]
823; CHECK-NEXT:    call void @non_dead_a13() [[ATTR2]]
824; CHECK-NEXT:    call void @non_dead_a14() [[ATTR2]]
825; CHECK-NEXT:    call void @non_dead_a15() [[ATTR2]]
826; CHECK-NEXT:    call void @middle()
827; CHECK-NEXT:    ret void
828;
829  call void @non_dead_a0()
830  call void @non_dead_a1()
831  call void @non_dead_a2()
832  call void @non_dead_a3()
833  call void @non_dead_a4()
834  call void @non_dead_a5()
835  call void @non_dead_a6()
836  call void @non_dead_a7()
837  call void @non_dead_a8()
838  call void @non_dead_a9()
839  call void @non_dead_a10()
840  call void @non_dead_a11()
841  call void @non_dead_a12()
842  call void @non_dead_a13()
843  call void @non_dead_a14()
844  call void @non_dead_a15()
845  call void @middle()
846  ret void
847}
848define internal void @middle() {
849; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@middle() {
850; NOT_CGSCC_NPM-NEXT:  bb0:
851; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b0() [[ATTR11:#.*]]
852; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b1() [[ATTR11]]
853; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b2() [[ATTR11]]
854; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b3() [[ATTR11]]
855; NOT_CGSCC_NPM-NEXT:    br label [[BB1:%.*]]
856; NOT_CGSCC_NPM:       bb1:
857; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b4() [[ATTR11]]
858; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b5() [[ATTR11]]
859; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b6() [[ATTR11]]
860; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b7() [[ATTR11]]
861; NOT_CGSCC_NPM-NEXT:    br label [[BB2:%.*]]
862; NOT_CGSCC_NPM:       bb2:
863; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b8() [[ATTR11]]
864; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b9() [[ATTR11]]
865; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b10() [[ATTR11]]
866; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b11() [[ATTR11]]
867; NOT_CGSCC_NPM-NEXT:    br label [[BB3:%.*]]
868; NOT_CGSCC_NPM:       bb3:
869; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b12() [[ATTR11]]
870; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b13() [[ATTR11]]
871; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b14() [[ATTR11]]
872; NOT_CGSCC_NPM-NEXT:    call void @non_dead_b15() [[ATTR11]]
873; NOT_CGSCC_NPM-NEXT:    br label [[BB4:%.*]]
874; NOT_CGSCC_NPM:       bb4:
875; NOT_CGSCC_NPM-NEXT:    call void @non_exact2()
876; NOT_CGSCC_NPM-NEXT:    ret void
877;
878; IS__CGSCC____-LABEL: define {{[^@]+}}@middle() {
879; IS__CGSCC____-NEXT:  bb0:
880; IS__CGSCC____-NEXT:    call void @non_dead_b0() [[ATTR16]]
881; IS__CGSCC____-NEXT:    call void @non_dead_b1() [[ATTR16]]
882; IS__CGSCC____-NEXT:    call void @non_dead_b2() [[ATTR16]]
883; IS__CGSCC____-NEXT:    call void @non_dead_b3() [[ATTR16]]
884; IS__CGSCC____-NEXT:    br label [[BB1:%.*]]
885; IS__CGSCC____:       bb1:
886; IS__CGSCC____-NEXT:    call void @non_dead_b4() [[ATTR16]]
887; IS__CGSCC____-NEXT:    call void @non_dead_b5() [[ATTR16]]
888; IS__CGSCC____-NEXT:    call void @non_dead_b6() [[ATTR16]]
889; IS__CGSCC____-NEXT:    call void @non_dead_b7() [[ATTR16]]
890; IS__CGSCC____-NEXT:    br label [[BB2:%.*]]
891; IS__CGSCC____:       bb2:
892; IS__CGSCC____-NEXT:    call void @non_dead_b8() [[ATTR16]]
893; IS__CGSCC____-NEXT:    call void @non_dead_b9() [[ATTR16]]
894; IS__CGSCC____-NEXT:    call void @non_dead_b10() [[ATTR16]]
895; IS__CGSCC____-NEXT:    call void @non_dead_b11() [[ATTR16]]
896; IS__CGSCC____-NEXT:    br label [[BB3:%.*]]
897; IS__CGSCC____:       bb3:
898; IS__CGSCC____-NEXT:    call void @non_dead_b12() [[ATTR16]]
899; IS__CGSCC____-NEXT:    call void @non_dead_b13() [[ATTR16]]
900; IS__CGSCC____-NEXT:    call void @non_dead_b14() [[ATTR16]]
901; IS__CGSCC____-NEXT:    call void @non_dead_b15() [[ATTR16]]
902; IS__CGSCC____-NEXT:    br label [[BB4:%.*]]
903; IS__CGSCC____:       bb4:
904; IS__CGSCC____-NEXT:    call void @non_exact2()
905; IS__CGSCC____-NEXT:    ret void
906;
907bb0:
908  call void @non_dead_b0()
909  call void @non_dead_b1()
910  call void @non_dead_b2()
911  call void @non_dead_b3()
912br label %bb1
913bb1:
914  call void @non_dead_b4()
915  call void @non_dead_b5()
916  call void @non_dead_b6()
917  call void @non_dead_b7()
918br label %bb2
919bb2:
920  call void @non_dead_b8()
921  call void @non_dead_b9()
922  call void @non_dead_b10()
923  call void @non_dead_b11()
924br label %bb3
925bb3:
926  call void @non_dead_b12()
927  call void @non_dead_b13()
928  call void @non_dead_b14()
929  call void @non_dead_b15()
930br label %bb4
931bb4:
932  call void @non_exact2()
933  ret void
934}
935define linkonce_odr void @non_exact2() {
936; CHECK-LABEL: define {{[^@]+}}@non_exact2() {
937; CHECK-NEXT:    call void @non_dead_c0() [[ATTR2]]
938; CHECK-NEXT:    call void @non_dead_c1() [[ATTR2]]
939; CHECK-NEXT:    call void @non_dead_c2() [[ATTR2]]
940; CHECK-NEXT:    call void @non_dead_c3() [[ATTR2]]
941; CHECK-NEXT:    call void @non_dead_c4() [[ATTR2]]
942; CHECK-NEXT:    call void @non_dead_c5() [[ATTR2]]
943; CHECK-NEXT:    call void @non_dead_c6() [[ATTR2]]
944; CHECK-NEXT:    call void @non_dead_c7() [[ATTR2]]
945; CHECK-NEXT:    call void @non_dead_c8() [[ATTR2]]
946; CHECK-NEXT:    call void @non_dead_c9() [[ATTR2]]
947; CHECK-NEXT:    call void @non_dead_c10() [[ATTR2]]
948; CHECK-NEXT:    call void @non_dead_c11() [[ATTR2]]
949; CHECK-NEXT:    call void @non_dead_c12() [[ATTR2]]
950; CHECK-NEXT:    call void @non_dead_c13() [[ATTR2]]
951; CHECK-NEXT:    call void @non_dead_c14() [[ATTR2]]
952; CHECK-NEXT:    call void @non_dead_c15() [[ATTR2]]
953; CHECK-NEXT:    call void @non_exact3()
954; CHECK-NEXT:    ret void
955;
956  call void @non_dead_c0()
957  call void @non_dead_c1()
958  call void @non_dead_c2()
959  call void @non_dead_c3()
960  call void @non_dead_c4()
961  call void @non_dead_c5()
962  call void @non_dead_c6()
963  call void @non_dead_c7()
964  call void @non_dead_c8()
965  call void @non_dead_c9()
966  call void @non_dead_c10()
967  call void @non_dead_c11()
968  call void @non_dead_c12()
969  call void @non_dead_c13()
970  call void @non_dead_c14()
971  call void @non_dead_c15()
972  call void @non_exact3()
973  ret void
974}
975define linkonce_odr void @non_exact3() {
976; CHECK-LABEL: define {{[^@]+}}@non_exact3() {
977; CHECK-NEXT:    call void @non_dead_d0() [[ATTR2]]
978; CHECK-NEXT:    call void @non_dead_d1() [[ATTR2]]
979; CHECK-NEXT:    call void @non_dead_d2() [[ATTR2]]
980; CHECK-NEXT:    call void @non_dead_d3() [[ATTR2]]
981; CHECK-NEXT:    call void @non_dead_d4() [[ATTR2]]
982; CHECK-NEXT:    call void @non_dead_d5() [[ATTR2]]
983; CHECK-NEXT:    call void @non_dead_d6() [[ATTR2]]
984; CHECK-NEXT:    call void @non_dead_d7() [[ATTR2]]
985; CHECK-NEXT:    call void @non_dead_d8() [[ATTR2]]
986; CHECK-NEXT:    call void @non_dead_d9() [[ATTR2]]
987; CHECK-NEXT:    call void @non_dead_d10() [[ATTR2]]
988; CHECK-NEXT:    call void @non_dead_d11() [[ATTR2]]
989; CHECK-NEXT:    call void @non_dead_d12() [[ATTR2]]
990; CHECK-NEXT:    call void @non_dead_d13() [[ATTR2]]
991; CHECK-NEXT:    call void @non_dead_d14() [[ATTR2]]
992; CHECK-NEXT:    call void @non_dead_d15() [[ATTR2]]
993; CHECK-NEXT:    [[NR:%.*]] = call i32 @foo_noreturn() [[ATTR4]]
994; CHECK-NEXT:    unreachable
995;
996  call void @non_dead_d0()
997  call void @non_dead_d1()
998  call void @non_dead_d2()
999  call void @non_dead_d3()
1000  call void @non_dead_d4()
1001  call void @non_dead_d5()
1002  call void @non_dead_d6()
1003  call void @non_dead_d7()
1004  call void @non_dead_d8()
1005  call void @non_dead_d9()
1006  call void @non_dead_d10()
1007  call void @non_dead_d11()
1008  call void @non_dead_d12()
1009  call void @non_dead_d13()
1010  call void @non_dead_d14()
1011  call void @non_dead_d15()
1012  %nr = call i32 @foo_noreturn()
1013  call void @dead_e1()
1014  ret void
1015}
1016
1017define internal void @non_dead_a0() {
1018; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1019; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a0
1020; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1021; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1022; NOT_CGSCC_NPM-NEXT:    ret void
1023;
1024; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1025; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a0
1026; IS__CGSCC____-SAME: () [[ATTR13:#.*]] {
1027; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1028; IS__CGSCC____-NEXT:    ret void
1029;
1030  call void @sink()
1031  ret void
1032}
1033define internal void @non_dead_a1() {
1034; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1035; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a1
1036; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1037; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1038; NOT_CGSCC_NPM-NEXT:    ret void
1039;
1040; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1041; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a1
1042; IS__CGSCC____-SAME: () [[ATTR13]] {
1043; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1044; IS__CGSCC____-NEXT:    ret void
1045;
1046  call void @sink()
1047  ret void
1048}
1049define internal void @non_dead_a2() {
1050; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1051; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a2
1052; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1053; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1054; NOT_CGSCC_NPM-NEXT:    ret void
1055;
1056; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1057; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a2
1058; IS__CGSCC____-SAME: () [[ATTR13]] {
1059; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1060; IS__CGSCC____-NEXT:    ret void
1061;
1062  call void @sink()
1063  ret void
1064}
1065define internal void @non_dead_a3() {
1066; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1067; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a3
1068; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1069; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1070; NOT_CGSCC_NPM-NEXT:    ret void
1071;
1072; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1073; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a3
1074; IS__CGSCC____-SAME: () [[ATTR13]] {
1075; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1076; IS__CGSCC____-NEXT:    ret void
1077;
1078  call void @sink()
1079  ret void
1080}
1081define internal void @non_dead_a4() {
1082; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1083; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a4
1084; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1085; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1086; NOT_CGSCC_NPM-NEXT:    ret void
1087;
1088; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1089; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a4
1090; IS__CGSCC____-SAME: () [[ATTR13]] {
1091; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1092; IS__CGSCC____-NEXT:    ret void
1093;
1094  call void @sink()
1095  ret void
1096}
1097define internal void @non_dead_a5() {
1098; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1099; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a5
1100; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1101; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1102; NOT_CGSCC_NPM-NEXT:    ret void
1103;
1104; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1105; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a5
1106; IS__CGSCC____-SAME: () [[ATTR13]] {
1107; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1108; IS__CGSCC____-NEXT:    ret void
1109;
1110  call void @sink()
1111  ret void
1112}
1113define internal void @non_dead_a6() {
1114; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1115; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a6
1116; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1117; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1118; NOT_CGSCC_NPM-NEXT:    ret void
1119;
1120; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1121; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a6
1122; IS__CGSCC____-SAME: () [[ATTR13]] {
1123; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1124; IS__CGSCC____-NEXT:    ret void
1125;
1126  call void @sink()
1127  ret void
1128}
1129define internal void @non_dead_a7() {
1130; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1131; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a7
1132; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1133; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1134; NOT_CGSCC_NPM-NEXT:    ret void
1135;
1136; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1137; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a7
1138; IS__CGSCC____-SAME: () [[ATTR13]] {
1139; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1140; IS__CGSCC____-NEXT:    ret void
1141;
1142  call void @sink()
1143  ret void
1144}
1145define internal void @non_dead_a8() {
1146; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1147; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a8
1148; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1149; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1150; NOT_CGSCC_NPM-NEXT:    ret void
1151;
1152; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1153; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a8
1154; IS__CGSCC____-SAME: () [[ATTR13]] {
1155; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1156; IS__CGSCC____-NEXT:    ret void
1157;
1158  call void @sink()
1159  ret void
1160}
1161define internal void @non_dead_a9() {
1162; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1163; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a9
1164; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1165; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1166; NOT_CGSCC_NPM-NEXT:    ret void
1167;
1168; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1169; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a9
1170; IS__CGSCC____-SAME: () [[ATTR13]] {
1171; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1172; IS__CGSCC____-NEXT:    ret void
1173;
1174  call void @sink()
1175  ret void
1176}
1177define internal void @non_dead_a10() {
1178; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1179; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a10
1180; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1181; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1182; NOT_CGSCC_NPM-NEXT:    ret void
1183;
1184; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1185; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a10
1186; IS__CGSCC____-SAME: () [[ATTR13]] {
1187; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1188; IS__CGSCC____-NEXT:    ret void
1189;
1190  call void @sink()
1191  ret void
1192}
1193define internal void @non_dead_a11() {
1194; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1195; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a11
1196; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1197; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1198; NOT_CGSCC_NPM-NEXT:    ret void
1199;
1200; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1201; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a11
1202; IS__CGSCC____-SAME: () [[ATTR13]] {
1203; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1204; IS__CGSCC____-NEXT:    ret void
1205;
1206  call void @sink()
1207  ret void
1208}
1209define internal void @non_dead_a12() {
1210; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1211; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a12
1212; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1213; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1214; NOT_CGSCC_NPM-NEXT:    ret void
1215;
1216; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1217; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a12
1218; IS__CGSCC____-SAME: () [[ATTR13]] {
1219; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1220; IS__CGSCC____-NEXT:    ret void
1221;
1222  call void @sink()
1223  ret void
1224}
1225define internal void @non_dead_a13() {
1226; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1227; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a13
1228; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1229; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1230; NOT_CGSCC_NPM-NEXT:    ret void
1231;
1232; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1233; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a13
1234; IS__CGSCC____-SAME: () [[ATTR13]] {
1235; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1236; IS__CGSCC____-NEXT:    ret void
1237;
1238  call void @sink()
1239  ret void
1240}
1241define internal void @non_dead_a14() {
1242; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1243; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a14
1244; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1245; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1246; NOT_CGSCC_NPM-NEXT:    ret void
1247;
1248; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1249; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a14
1250; IS__CGSCC____-SAME: () [[ATTR13]] {
1251; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1252; IS__CGSCC____-NEXT:    ret void
1253;
1254  call void @sink()
1255  ret void
1256}
1257define internal void @non_dead_a15() {
1258; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1259; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_a15
1260; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1261; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1262; NOT_CGSCC_NPM-NEXT:    ret void
1263;
1264; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1265; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_a15
1266; IS__CGSCC____-SAME: () [[ATTR13]] {
1267; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1268; IS__CGSCC____-NEXT:    ret void
1269;
1270  call void @sink()
1271  ret void
1272}
1273define internal void @non_dead_b0() {
1274; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1275; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b0
1276; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1277; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1278; NOT_CGSCC_NPM-NEXT:    ret void
1279;
1280; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1281; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b0
1282; IS__CGSCC____-SAME: () [[ATTR13]] {
1283; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1284; IS__CGSCC____-NEXT:    ret void
1285;
1286  call void @sink()
1287  ret void
1288}
1289define internal void @non_dead_b1() {
1290; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1291; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b1
1292; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1293; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1294; NOT_CGSCC_NPM-NEXT:    ret void
1295;
1296; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1297; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b1
1298; IS__CGSCC____-SAME: () [[ATTR13]] {
1299; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1300; IS__CGSCC____-NEXT:    ret void
1301;
1302  call void @sink()
1303  ret void
1304}
1305define internal void @non_dead_b2() {
1306; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1307; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b2
1308; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1309; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1310; NOT_CGSCC_NPM-NEXT:    ret void
1311;
1312; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1313; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b2
1314; IS__CGSCC____-SAME: () [[ATTR13]] {
1315; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1316; IS__CGSCC____-NEXT:    ret void
1317;
1318  call void @sink()
1319  ret void
1320}
1321define internal void @non_dead_b3() {
1322; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1323; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b3
1324; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1325; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1326; NOT_CGSCC_NPM-NEXT:    ret void
1327;
1328; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1329; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b3
1330; IS__CGSCC____-SAME: () [[ATTR13]] {
1331; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1332; IS__CGSCC____-NEXT:    ret void
1333;
1334  call void @sink()
1335  ret void
1336}
1337define internal void @non_dead_b4() {
1338; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1339; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b4
1340; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1341; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1342; NOT_CGSCC_NPM-NEXT:    ret void
1343;
1344; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1345; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b4
1346; IS__CGSCC____-SAME: () [[ATTR13]] {
1347; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1348; IS__CGSCC____-NEXT:    ret void
1349;
1350  call void @sink()
1351  ret void
1352}
1353define internal void @non_dead_b5() {
1354; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1355; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b5
1356; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1357; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1358; NOT_CGSCC_NPM-NEXT:    ret void
1359;
1360; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1361; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b5
1362; IS__CGSCC____-SAME: () [[ATTR13]] {
1363; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1364; IS__CGSCC____-NEXT:    ret void
1365;
1366  call void @sink()
1367  ret void
1368}
1369define internal void @non_dead_b6() {
1370; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1371; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b6
1372; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1373; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1374; NOT_CGSCC_NPM-NEXT:    ret void
1375;
1376; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1377; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b6
1378; IS__CGSCC____-SAME: () [[ATTR13]] {
1379; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1380; IS__CGSCC____-NEXT:    ret void
1381;
1382  call void @sink()
1383  ret void
1384}
1385define internal void @non_dead_b7() {
1386; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1387; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b7
1388; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1389; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1390; NOT_CGSCC_NPM-NEXT:    ret void
1391;
1392; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1393; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b7
1394; IS__CGSCC____-SAME: () [[ATTR13]] {
1395; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1396; IS__CGSCC____-NEXT:    ret void
1397;
1398  call void @sink()
1399  ret void
1400}
1401define internal void @non_dead_b8() {
1402; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1403; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b8
1404; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1405; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1406; NOT_CGSCC_NPM-NEXT:    ret void
1407;
1408; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1409; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b8
1410; IS__CGSCC____-SAME: () [[ATTR13]] {
1411; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1412; IS__CGSCC____-NEXT:    ret void
1413;
1414  call void @sink()
1415  ret void
1416}
1417define internal void @non_dead_b9() {
1418; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1419; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b9
1420; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1421; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1422; NOT_CGSCC_NPM-NEXT:    ret void
1423;
1424; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1425; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b9
1426; IS__CGSCC____-SAME: () [[ATTR13]] {
1427; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1428; IS__CGSCC____-NEXT:    ret void
1429;
1430  call void @sink()
1431  ret void
1432}
1433define internal void @non_dead_b10() {
1434; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1435; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b10
1436; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1437; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1438; NOT_CGSCC_NPM-NEXT:    ret void
1439;
1440; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1441; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b10
1442; IS__CGSCC____-SAME: () [[ATTR13]] {
1443; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1444; IS__CGSCC____-NEXT:    ret void
1445;
1446  call void @sink()
1447  ret void
1448}
1449define internal void @non_dead_b11() {
1450; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1451; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b11
1452; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1453; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1454; NOT_CGSCC_NPM-NEXT:    ret void
1455;
1456; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1457; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b11
1458; IS__CGSCC____-SAME: () [[ATTR13]] {
1459; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1460; IS__CGSCC____-NEXT:    ret void
1461;
1462  call void @sink()
1463  ret void
1464}
1465define internal void @non_dead_b12() {
1466; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1467; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b12
1468; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1469; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1470; NOT_CGSCC_NPM-NEXT:    ret void
1471;
1472; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1473; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b12
1474; IS__CGSCC____-SAME: () [[ATTR13]] {
1475; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1476; IS__CGSCC____-NEXT:    ret void
1477;
1478  call void @sink()
1479  ret void
1480}
1481define internal void @non_dead_b13() {
1482; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1483; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b13
1484; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1485; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1486; NOT_CGSCC_NPM-NEXT:    ret void
1487;
1488; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1489; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b13
1490; IS__CGSCC____-SAME: () [[ATTR13]] {
1491; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1492; IS__CGSCC____-NEXT:    ret void
1493;
1494  call void @sink()
1495  ret void
1496}
1497define internal void @non_dead_b14() {
1498; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1499; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b14
1500; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1501; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1502; NOT_CGSCC_NPM-NEXT:    ret void
1503;
1504; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1505; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b14
1506; IS__CGSCC____-SAME: () [[ATTR13]] {
1507; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1508; IS__CGSCC____-NEXT:    ret void
1509;
1510  call void @sink()
1511  ret void
1512}
1513define internal void @non_dead_b15() {
1514; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1515; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_b15
1516; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1517; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1518; NOT_CGSCC_NPM-NEXT:    ret void
1519;
1520; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1521; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_b15
1522; IS__CGSCC____-SAME: () [[ATTR13]] {
1523; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1524; IS__CGSCC____-NEXT:    ret void
1525;
1526  call void @sink()
1527  ret void
1528}
1529define internal void @non_dead_c0() {
1530; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1531; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c0
1532; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1533; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1534; NOT_CGSCC_NPM-NEXT:    ret void
1535;
1536; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1537; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c0
1538; IS__CGSCC____-SAME: () [[ATTR13]] {
1539; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1540; IS__CGSCC____-NEXT:    ret void
1541;
1542  call void @sink()
1543  ret void
1544}
1545define internal void @non_dead_c1() {
1546; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1547; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c1
1548; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1549; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1550; NOT_CGSCC_NPM-NEXT:    ret void
1551;
1552; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1553; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c1
1554; IS__CGSCC____-SAME: () [[ATTR13]] {
1555; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1556; IS__CGSCC____-NEXT:    ret void
1557;
1558  call void @sink()
1559  ret void
1560}
1561define internal void @non_dead_c2() {
1562; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1563; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c2
1564; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1565; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1566; NOT_CGSCC_NPM-NEXT:    ret void
1567;
1568; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1569; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c2
1570; IS__CGSCC____-SAME: () [[ATTR13]] {
1571; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1572; IS__CGSCC____-NEXT:    ret void
1573;
1574  call void @sink()
1575  ret void
1576}
1577define internal void @non_dead_c3() {
1578; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1579; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c3
1580; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1581; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1582; NOT_CGSCC_NPM-NEXT:    ret void
1583;
1584; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1585; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c3
1586; IS__CGSCC____-SAME: () [[ATTR13]] {
1587; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1588; IS__CGSCC____-NEXT:    ret void
1589;
1590  call void @sink()
1591  ret void
1592}
1593define internal void @non_dead_c4() {
1594; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1595; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c4
1596; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1597; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1598; NOT_CGSCC_NPM-NEXT:    ret void
1599;
1600; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1601; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c4
1602; IS__CGSCC____-SAME: () [[ATTR13]] {
1603; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1604; IS__CGSCC____-NEXT:    ret void
1605;
1606  call void @sink()
1607  ret void
1608}
1609define internal void @non_dead_c5() {
1610; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1611; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c5
1612; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1613; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1614; NOT_CGSCC_NPM-NEXT:    ret void
1615;
1616; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1617; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c5
1618; IS__CGSCC____-SAME: () [[ATTR13]] {
1619; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1620; IS__CGSCC____-NEXT:    ret void
1621;
1622  call void @sink()
1623  ret void
1624}
1625define internal void @non_dead_c6() {
1626; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1627; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c6
1628; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1629; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1630; NOT_CGSCC_NPM-NEXT:    ret void
1631;
1632; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1633; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c6
1634; IS__CGSCC____-SAME: () [[ATTR13]] {
1635; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1636; IS__CGSCC____-NEXT:    ret void
1637;
1638  call void @sink()
1639  ret void
1640}
1641define internal void @non_dead_c7() {
1642; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1643; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c7
1644; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1645; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1646; NOT_CGSCC_NPM-NEXT:    ret void
1647;
1648; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1649; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c7
1650; IS__CGSCC____-SAME: () [[ATTR13]] {
1651; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1652; IS__CGSCC____-NEXT:    ret void
1653;
1654  call void @sink()
1655  ret void
1656}
1657define internal void @non_dead_c8() {
1658; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1659; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c8
1660; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1661; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1662; NOT_CGSCC_NPM-NEXT:    ret void
1663;
1664; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1665; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c8
1666; IS__CGSCC____-SAME: () [[ATTR13]] {
1667; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1668; IS__CGSCC____-NEXT:    ret void
1669;
1670  call void @sink()
1671  ret void
1672}
1673define internal void @non_dead_c9() {
1674; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1675; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c9
1676; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1677; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1678; NOT_CGSCC_NPM-NEXT:    ret void
1679;
1680; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1681; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c9
1682; IS__CGSCC____-SAME: () [[ATTR13]] {
1683; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1684; IS__CGSCC____-NEXT:    ret void
1685;
1686  call void @sink()
1687  ret void
1688}
1689define internal void @non_dead_c10() {
1690; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1691; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c10
1692; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1693; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1694; NOT_CGSCC_NPM-NEXT:    ret void
1695;
1696; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1697; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c10
1698; IS__CGSCC____-SAME: () [[ATTR13]] {
1699; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1700; IS__CGSCC____-NEXT:    ret void
1701;
1702  call void @sink()
1703  ret void
1704}
1705define internal void @non_dead_c11() {
1706; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1707; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c11
1708; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1709; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1710; NOT_CGSCC_NPM-NEXT:    ret void
1711;
1712; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1713; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c11
1714; IS__CGSCC____-SAME: () [[ATTR13]] {
1715; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1716; IS__CGSCC____-NEXT:    ret void
1717;
1718  call void @sink()
1719  ret void
1720}
1721define internal void @non_dead_c12() {
1722; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1723; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c12
1724; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1725; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1726; NOT_CGSCC_NPM-NEXT:    ret void
1727;
1728; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1729; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c12
1730; IS__CGSCC____-SAME: () [[ATTR13]] {
1731; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1732; IS__CGSCC____-NEXT:    ret void
1733;
1734  call void @sink()
1735  ret void
1736}
1737define internal void @non_dead_c13() {
1738; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1739; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c13
1740; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1741; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1742; NOT_CGSCC_NPM-NEXT:    ret void
1743;
1744; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1745; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c13
1746; IS__CGSCC____-SAME: () [[ATTR13]] {
1747; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1748; IS__CGSCC____-NEXT:    ret void
1749;
1750  call void @sink()
1751  ret void
1752}
1753define internal void @non_dead_c14() {
1754; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1755; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c14
1756; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1757; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1758; NOT_CGSCC_NPM-NEXT:    ret void
1759;
1760; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1761; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c14
1762; IS__CGSCC____-SAME: () [[ATTR13]] {
1763; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1764; IS__CGSCC____-NEXT:    ret void
1765;
1766  call void @sink()
1767  ret void
1768}
1769define internal void @non_dead_c15() {
1770; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1771; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_c15
1772; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1773; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1774; NOT_CGSCC_NPM-NEXT:    ret void
1775;
1776; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1777; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_c15
1778; IS__CGSCC____-SAME: () [[ATTR13]] {
1779; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1780; IS__CGSCC____-NEXT:    ret void
1781;
1782  call void @sink()
1783  ret void
1784}
1785define internal void @non_dead_d0() {
1786; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1787; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d0
1788; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1789; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1790; NOT_CGSCC_NPM-NEXT:    ret void
1791;
1792; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1793; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d0
1794; IS__CGSCC____-SAME: () [[ATTR13]] {
1795; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1796; IS__CGSCC____-NEXT:    ret void
1797;
1798  call void @sink()
1799  ret void
1800}
1801define internal void @non_dead_d1() {
1802; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1803; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d1
1804; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1805; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1806; NOT_CGSCC_NPM-NEXT:    ret void
1807;
1808; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1809; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d1
1810; IS__CGSCC____-SAME: () [[ATTR13]] {
1811; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1812; IS__CGSCC____-NEXT:    ret void
1813;
1814  call void @sink()
1815  ret void
1816}
1817define internal void @non_dead_d2() {
1818; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1819; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d2
1820; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1821; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1822; NOT_CGSCC_NPM-NEXT:    ret void
1823;
1824; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1825; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d2
1826; IS__CGSCC____-SAME: () [[ATTR13]] {
1827; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1828; IS__CGSCC____-NEXT:    ret void
1829;
1830  call void @sink()
1831  ret void
1832}
1833define internal void @non_dead_d3() {
1834; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1835; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d3
1836; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1837; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1838; NOT_CGSCC_NPM-NEXT:    ret void
1839;
1840; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1841; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d3
1842; IS__CGSCC____-SAME: () [[ATTR13]] {
1843; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1844; IS__CGSCC____-NEXT:    ret void
1845;
1846  call void @sink()
1847  ret void
1848}
1849define internal void @non_dead_d4() {
1850; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1851; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d4
1852; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1853; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1854; NOT_CGSCC_NPM-NEXT:    ret void
1855;
1856; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1857; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d4
1858; IS__CGSCC____-SAME: () [[ATTR13]] {
1859; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1860; IS__CGSCC____-NEXT:    ret void
1861;
1862  call void @sink()
1863  ret void
1864}
1865define internal void @non_dead_d5() {
1866; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1867; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d5
1868; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1869; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1870; NOT_CGSCC_NPM-NEXT:    ret void
1871;
1872; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1873; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d5
1874; IS__CGSCC____-SAME: () [[ATTR13]] {
1875; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1876; IS__CGSCC____-NEXT:    ret void
1877;
1878  call void @sink()
1879  ret void
1880}
1881define internal void @non_dead_d6() {
1882; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1883; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d6
1884; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1885; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1886; NOT_CGSCC_NPM-NEXT:    ret void
1887;
1888; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1889; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d6
1890; IS__CGSCC____-SAME: () [[ATTR13]] {
1891; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1892; IS__CGSCC____-NEXT:    ret void
1893;
1894  call void @sink()
1895  ret void
1896}
1897define internal void @non_dead_d7() {
1898; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1899; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d7
1900; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1901; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1902; NOT_CGSCC_NPM-NEXT:    ret void
1903;
1904; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1905; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d7
1906; IS__CGSCC____-SAME: () [[ATTR13]] {
1907; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1908; IS__CGSCC____-NEXT:    ret void
1909;
1910  call void @sink()
1911  ret void
1912}
1913define internal void @non_dead_d8() {
1914; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1915; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d8
1916; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1917; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1918; NOT_CGSCC_NPM-NEXT:    ret void
1919;
1920; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1921; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d8
1922; IS__CGSCC____-SAME: () [[ATTR13]] {
1923; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1924; IS__CGSCC____-NEXT:    ret void
1925;
1926  call void @sink()
1927  ret void
1928}
1929define internal void @non_dead_d9() {
1930; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1931; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d9
1932; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1933; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1934; NOT_CGSCC_NPM-NEXT:    ret void
1935;
1936; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1937; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d9
1938; IS__CGSCC____-SAME: () [[ATTR13]] {
1939; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1940; IS__CGSCC____-NEXT:    ret void
1941;
1942  call void @sink()
1943  ret void
1944}
1945define internal void @non_dead_d10() {
1946; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1947; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d10
1948; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1949; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1950; NOT_CGSCC_NPM-NEXT:    ret void
1951;
1952; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1953; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d10
1954; IS__CGSCC____-SAME: () [[ATTR13]] {
1955; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1956; IS__CGSCC____-NEXT:    ret void
1957;
1958  call void @sink()
1959  ret void
1960}
1961define internal void @non_dead_d11() {
1962; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1963; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d11
1964; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1965; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1966; NOT_CGSCC_NPM-NEXT:    ret void
1967;
1968; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1969; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d11
1970; IS__CGSCC____-SAME: () [[ATTR13]] {
1971; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1972; IS__CGSCC____-NEXT:    ret void
1973;
1974  call void @sink()
1975  ret void
1976}
1977define internal void @non_dead_d12() {
1978; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1979; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d12
1980; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1981; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1982; NOT_CGSCC_NPM-NEXT:    ret void
1983;
1984; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
1985; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d12
1986; IS__CGSCC____-SAME: () [[ATTR13]] {
1987; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
1988; IS__CGSCC____-NEXT:    ret void
1989;
1990  call void @sink()
1991  ret void
1992}
1993define internal void @non_dead_d13() {
1994; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
1995; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d13
1996; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
1997; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
1998; NOT_CGSCC_NPM-NEXT:    ret void
1999;
2000; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2001; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d13
2002; IS__CGSCC____-SAME: () [[ATTR13]] {
2003; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
2004; IS__CGSCC____-NEXT:    ret void
2005;
2006  call void @sink()
2007  ret void
2008}
2009define internal void @non_dead_d14() {
2010; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
2011; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d14
2012; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
2013; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
2014; NOT_CGSCC_NPM-NEXT:    ret void
2015;
2016; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2017; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d14
2018; IS__CGSCC____-SAME: () [[ATTR13]] {
2019; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
2020; IS__CGSCC____-NEXT:    ret void
2021;
2022  call void @sink()
2023  ret void
2024}
2025define internal void @non_dead_d15() {
2026; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
2027; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@non_dead_d15
2028; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
2029; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
2030; NOT_CGSCC_NPM-NEXT:    ret void
2031;
2032; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2033; IS__CGSCC____-LABEL: define {{[^@]+}}@non_dead_d15
2034; IS__CGSCC____-SAME: () [[ATTR13]] {
2035; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
2036; IS__CGSCC____-NEXT:    ret void
2037;
2038  call void @sink()
2039  ret void
2040}
2041define internal void @dead_e0() { call void @dead_e1() ret void }
2042; IS__CGSCC____-LABEL: define {{[^@]+}}@dead_e0() {
2043; IS__CGSCC____-NEXT:    call void @dead_e1()
2044; IS__CGSCC____-NEXT:    ret void
2045;
2046define internal void @dead_e1() { call void @dead_e2() ret void }
2047define internal void @dead_e2() { ret void }
2048
2049; Verify we actually deduce information for these functions.
2050
2051declare void @blowup() noreturn
2052define void @live_with_dead_entry() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
2053entry:
2054  invoke void @blowup() to label %live_with_dead_entry unwind label %lpad
2055lpad:
2056  %0 = landingpad { i8*, i32 } catch i8* null
2057  br label %live_with_dead_entry
2058live_with_dead_entry:
2059  ret void
2060}
2061
2062define void @live_with_dead_entry_lp() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
2063; CHECK: Function Attrs: nounwind
2064; CHECK-LABEL: define {{[^@]+}}@live_with_dead_entry_lp
2065; CHECK-SAME: () [[ATTR2]] personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
2066; CHECK-NEXT:  entry:
2067; CHECK-NEXT:    invoke void @blowup() [[ATTR4]]
2068; CHECK-NEXT:    to label [[LIVE_WITH_DEAD_ENTRY_DEAD:%.*]] unwind label [[LP1:%.*]]
2069; CHECK:       lp1:
2070; CHECK-NEXT:    [[LP:%.*]] = landingpad { i8*, i32 }
2071; CHECK-NEXT:    catch i8* null
2072; CHECK-NEXT:    invoke void @blowup() [[ATTR4]]
2073; CHECK-NEXT:    to label [[LIVE_WITH_DEAD_ENTRY_DEAD1:%.*]] unwind label [[LP2:%.*]]
2074; CHECK:       lp2:
2075; CHECK-NEXT:    [[TMP0:%.*]] = landingpad { i8*, i32 }
2076; CHECK-NEXT:    catch i8* null
2077; CHECK-NEXT:    br label [[LIVE_WITH_DEAD_ENTRY:%.*]]
2078; CHECK:       live_with_dead_entry.dead:
2079; CHECK-NEXT:    unreachable
2080; CHECK:       live_with_dead_entry.dead1:
2081; CHECK-NEXT:    unreachable
2082; CHECK:       live_with_dead_entry:
2083; CHECK-NEXT:    ret void
2084;
2085entry:
2086  invoke void @blowup() to label %live_with_dead_entry unwind label %lp1
2087lp1:
2088  %lp = landingpad { i8*, i32 } catch i8* null
2089  invoke void @blowup() to label %live_with_dead_entry unwind label %lp2
2090lp2:
2091  %0 = landingpad { i8*, i32 } catch i8* null
2092  br label %live_with_dead_entry
2093live_with_dead_entry:
2094  ret void
2095}
2096
2097define internal void @useless_arg_sink(i32* %a) {
2098; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
2099; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@useless_arg_sink
2100; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
2101; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
2102; NOT_CGSCC_NPM-NEXT:    ret void
2103;
2104; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2105; IS__CGSCC____-LABEL: define {{[^@]+}}@useless_arg_sink
2106; IS__CGSCC____-SAME: () [[ATTR13]] {
2107; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
2108; IS__CGSCC____-NEXT:    ret void
2109;
2110  call void @sink()
2111  ret void
2112}
2113
2114define internal void @useless_arg_almost_sink(i32* %a) {
2115; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
2116; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@useless_arg_almost_sink
2117; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
2118; NOT_CGSCC_NPM-NEXT:    call void @useless_arg_sink() [[ATTR11]]
2119; NOT_CGSCC_NPM-NEXT:    ret void
2120;
2121; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2122; IS__CGSCC____-LABEL: define {{[^@]+}}@useless_arg_almost_sink
2123; IS__CGSCC____-SAME: () [[ATTR13]] {
2124; IS__CGSCC____-NEXT:    call void @useless_arg_sink() [[ATTR16]]
2125; IS__CGSCC____-NEXT:    ret void
2126;
2127  call void @useless_arg_sink(i32* %a)
2128  ret void
2129}
2130
2131; Check we do not annotate the function interface of this weak function.
2132define weak_odr void @useless_arg_ext(i32* %a) {
2133; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext
2134; CHECK-SAME: (i32* [[A:%.*]]) {
2135; CHECK-NEXT:    call void @useless_arg_almost_sink() [[ATTR2]]
2136; CHECK-NEXT:    ret void
2137;
2138  call void @useless_arg_almost_sink(i32* %a)
2139  ret void
2140}
2141
2142define internal void @useless_arg_ext_int(i32* %a) {
2143; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext_int
2144; CHECK-SAME: (i32* [[A:%.*]]) {
2145; CHECK-NEXT:    call void @useless_arg_ext(i32* [[A]])
2146; CHECK-NEXT:    ret void
2147;
2148  call void @useless_arg_ext(i32* %a)
2149  ret void
2150}
2151
2152define void @useless_arg_ext_int_ext(i32* %a) {
2153; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext_int_ext
2154; CHECK-SAME: (i32* [[A:%.*]]) {
2155; CHECK-NEXT:    call void @useless_arg_ext_int(i32* [[A]])
2156; CHECK-NEXT:    ret void
2157;
2158  call void @useless_arg_ext_int(i32* %a)
2159  ret void
2160}
2161
2162; FIXME: We should fold terminators.
2163
2164define internal i32 @switch_default(i64 %i) nounwind {
2165; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
2166; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@switch_default
2167; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
2168; NOT_CGSCC_NPM-NEXT:  entry:
2169; NOT_CGSCC_NPM-NEXT:    switch i64 0, label [[SW_DEFAULT:%.*]] [
2170; NOT_CGSCC_NPM-NEXT:    i64 3, label [[RETURN:%.*]]
2171; NOT_CGSCC_NPM-NEXT:    i64 10, label [[RETURN]]
2172; NOT_CGSCC_NPM-NEXT:    ]
2173; NOT_CGSCC_NPM:       sw.default:
2174; NOT_CGSCC_NPM-NEXT:    call void @sink() [[ATTR14]]
2175; NOT_CGSCC_NPM-NEXT:    ret i32 undef
2176; NOT_CGSCC_NPM:       return:
2177; NOT_CGSCC_NPM-NEXT:    unreachable
2178;
2179; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2180; IS__CGSCC____-LABEL: define {{[^@]+}}@switch_default
2181; IS__CGSCC____-SAME: () [[ATTR13]] {
2182; IS__CGSCC____-NEXT:  entry:
2183; IS__CGSCC____-NEXT:    switch i64 0, label [[SW_DEFAULT:%.*]] [
2184; IS__CGSCC____-NEXT:    i64 3, label [[RETURN:%.*]]
2185; IS__CGSCC____-NEXT:    i64 10, label [[RETURN]]
2186; IS__CGSCC____-NEXT:    ]
2187; IS__CGSCC____:       sw.default:
2188; IS__CGSCC____-NEXT:    call void @sink() [[ATTR16]]
2189; IS__CGSCC____-NEXT:    ret i32 undef
2190; IS__CGSCC____:       return:
2191; IS__CGSCC____-NEXT:    unreachable
2192;
2193entry:
2194  switch i64 %i, label %sw.default [
2195  i64 3, label %return
2196  i64 10, label %return
2197  ]
2198
2199sw.default:
2200  call void @sink()
2201  ret i32 123
2202
2203return:
2204  ret i32 0
2205}
2206
2207define i32 @switch_default_caller() {
2208; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind willreturn
2209; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@switch_default_caller
2210; NOT_CGSCC_NPM-SAME: () [[ATTR11]] {
2211; NOT_CGSCC_NPM-NEXT:    [[CALL2:%.*]] = tail call i32 @switch_default() [[ATTR11]]
2212; NOT_CGSCC_NPM-NEXT:    ret i32 123
2213;
2214; IS__CGSCC____: Function Attrs: nofree nosync nounwind willreturn
2215; IS__CGSCC____-LABEL: define {{[^@]+}}@switch_default_caller
2216; IS__CGSCC____-SAME: () [[ATTR13]] {
2217; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = tail call i32 @switch_default() [[ATTR16]]
2218; IS__CGSCC____-NEXT:    ret i32 123
2219;
2220  %call2 = tail call i32 @switch_default(i64 0)
2221  ret i32 %call2
2222}
2223
2224define internal i32 @switch_default_dead(i64 %i) nounwind {
2225; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2226; IS__CGSCC____-LABEL: define {{[^@]+}}@switch_default_dead
2227; IS__CGSCC____-SAME: () [[ATTR6]] {
2228; IS__CGSCC____-NEXT:  entry:
2229; IS__CGSCC____-NEXT:    switch i64 0, label [[SW_DEFAULT:%.*]] [
2230; IS__CGSCC____-NEXT:    i64 3, label [[RETURN:%.*]]
2231; IS__CGSCC____-NEXT:    i64 10, label [[RETURN]]
2232; IS__CGSCC____-NEXT:    ]
2233; IS__CGSCC____:       sw.default:
2234; IS__CGSCC____-NEXT:    ret i32 undef
2235; IS__CGSCC____:       return:
2236; IS__CGSCC____-NEXT:    unreachable
2237;
2238entry:
2239  switch i64 %i, label %sw.default [
2240  i64 3, label %return
2241  i64 10, label %return
2242  ]
2243
2244sw.default:
2245  ret i32 123
2246
2247return:
2248  ret i32 0
2249}
2250
2251define i32 @switch_default_dead_caller() {
2252; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2253; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@switch_default_dead_caller
2254; NOT_CGSCC_NPM-SAME: () [[ATTR12:#.*]] {
2255; NOT_CGSCC_NPM-NEXT:    ret i32 123
2256;
2257; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2258; IS__CGSCC____-LABEL: define {{[^@]+}}@switch_default_dead_caller
2259; IS__CGSCC____-SAME: () [[ATTR6]] {
2260; IS__CGSCC____-NEXT:    ret i32 123
2261;
2262  %call2 = tail call i32 @switch_default_dead(i64 0)
2263  ret i32 %call2
2264}
2265
2266define void @call_via_pointer_with_dead_args(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) {
2267; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args
2268; CHECK-SAME: (i32* [[A:%.*]], i32* [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree nonnull [[FP:%.*]]) {
2269; CHECK-NEXT:    call void [[FP]](i32* [[A]], i32* [[B]], i32* [[A]], i64 -1, i32** null)
2270; CHECK-NEXT:    ret void
2271;
2272  call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null)
2273  ret void
2274}
2275; FIXME: We have to prevent the propagation of %fp in the new pm CGSCC pass until the CallGraphUpdater can handle the new call edge.
2276define internal void @call_via_pointer_with_dead_args_internal_a(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) {
2277; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a
2278; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) {
2279; NOT_CGSCC_NPM-NEXT:    call void @called_via_pointer(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
2280; NOT_CGSCC_NPM-NEXT:    ret void
2281;
2282; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a
2283; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) {
2284; IS__CGSCC____-NEXT:    call void [[FP]](i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
2285; IS__CGSCC____-NEXT:    ret void
2286;
2287  call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null)
2288  ret void
2289}
2290define internal void @call_via_pointer_with_dead_args_internal_b(i32* %a, i32* %b, void (i32*, i32*, i32*, i64, i32**)* %fp) {
2291; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b
2292; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) {
2293; NOT_CGSCC_NPM-NEXT:    call void @called_via_pointer_internal_2(i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
2294; NOT_CGSCC_NPM-NEXT:    ret void
2295;
2296; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b
2297; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* noundef nonnull align 128 dereferenceable(4) [[B:%.*]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull [[FP:%.*]]) {
2298; IS__CGSCC____-NEXT:    call void [[FP]](i32* [[A]], i32* nonnull align 128 dereferenceable(4) [[B]], i32* [[A]], i64 -1, i32** null)
2299; IS__CGSCC____-NEXT:    ret void
2300;
2301  call void %fp(i32* %a, i32* %b, i32* %a, i64 -1, i32** null)
2302  ret void
2303}
2304define void @call_via_pointer_with_dead_args_caller(i32* %a, i32* %b) {
2305; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_caller
2306; NOT_CGSCC_NPM-SAME: (i32* [[A:%.*]], i32* [[B:%.*]]) {
2307; NOT_CGSCC_NPM-NEXT:    [[PTR1:%.*]] = alloca i32, align 128
2308; NOT_CGSCC_NPM-NEXT:    [[PTR2:%.*]] = alloca i32, align 128
2309; NOT_CGSCC_NPM-NEXT:    [[PTR3:%.*]] = alloca i32, align 128
2310; NOT_CGSCC_NPM-NEXT:    [[PTR4:%.*]] = alloca i32, align 128
2311; NOT_CGSCC_NPM-NEXT:    call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR1]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef @called_via_pointer)
2312; NOT_CGSCC_NPM-NEXT:    call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR2]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef @called_via_pointer_internal_1)
2313; NOT_CGSCC_NPM-NEXT:    call void @call_via_pointer_with_dead_args_internal_a(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR3]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef @called_via_pointer)
2314; NOT_CGSCC_NPM-NEXT:    call void @call_via_pointer_with_dead_args_internal_b(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR4]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef @called_via_pointer_internal_2)
2315; NOT_CGSCC_NPM-NEXT:    ret void
2316;
2317; IS__CGSCC____-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_caller
2318; IS__CGSCC____-SAME: (i32* [[A:%.*]], i32* [[B:%.*]]) {
2319; IS__CGSCC____-NEXT:    [[PTR1:%.*]] = alloca i32, align 128
2320; IS__CGSCC____-NEXT:    [[PTR2:%.*]] = alloca i32, align 128
2321; IS__CGSCC____-NEXT:    [[PTR3:%.*]] = alloca i32, align 128
2322; IS__CGSCC____-NEXT:    [[PTR4:%.*]] = alloca i32, align 128
2323; IS__CGSCC____-NEXT:    call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR1]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer)
2324; IS__CGSCC____-NEXT:    call void @call_via_pointer_with_dead_args(i32* [[A]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR2]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer_internal_1)
2325; IS__CGSCC____-NEXT:    call void @call_via_pointer_with_dead_args_internal_a(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR3]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer)
2326; IS__CGSCC____-NEXT:    call void @call_via_pointer_with_dead_args_internal_b(i32* [[B]], i32* noundef nonnull align 128 dereferenceable(4) [[PTR4]], void (i32*, i32*, i32*, i64, i32**)* nocapture nofree noundef nonnull @called_via_pointer_internal_2)
2327; IS__CGSCC____-NEXT:    ret void
2328;
2329  %ptr1 = alloca i32, align 128
2330  %ptr2 = alloca i32, align 128
2331  %ptr3 = alloca i32, align 128
2332  %ptr4 = alloca i32, align 128
2333  call void @call_via_pointer_with_dead_args(i32* %a, i32* %ptr1, void (i32*, i32*, i32*, i64, i32**)* @called_via_pointer)
2334  call void @call_via_pointer_with_dead_args(i32* %a, i32* %ptr2, void (i32*, i32*, i32*, i64, i32**)* @called_via_pointer_internal_1)
2335  call void @call_via_pointer_with_dead_args_internal_a(i32* %b, i32* %ptr3, void (i32*, i32*, i32*, i64, i32**)* @called_via_pointer)
2336  call void @call_via_pointer_with_dead_args_internal_b(i32* %b, i32* %ptr4, void (i32*, i32*, i32*, i64, i32**)* @called_via_pointer_internal_2)
2337  ret void
2338}
2339define void @called_via_pointer(i32* %a, i32* %b, i32* %c, i64 %d, i32** %e) {
2340; CHECK-LABEL: define {{[^@]+}}@called_via_pointer
2341; CHECK-SAME: (i32* [[A:%.*]], i32* nocapture nofree readnone [[B:%.*]], i32* nocapture nofree readnone [[C:%.*]], i64 [[D:%.*]], i32** nocapture nofree readnone [[E:%.*]]) {
2342; CHECK-NEXT:  entry:
2343; CHECK-NEXT:    tail call void @use_i32p(i32* [[A]])
2344; CHECK-NEXT:    tail call void @use_i32p(i32* [[A]])
2345; CHECK-NEXT:    ret void
2346;
2347entry:
2348  tail call void @use_i32p(i32* %a)
2349  tail call void @use_i32p(i32* %a)
2350  ret void
2351}
2352define internal void @called_via_pointer_internal_1(i32* %a, i32* %b, i32* %c, i64 %d, i32** %e) {
2353; CHECK-LABEL: define {{[^@]+}}@called_via_pointer_internal_1
2354; CHECK-SAME: (i32* [[A:%.*]], i32* nocapture nofree readnone [[B:%.*]], i32* nocapture nofree readnone [[C:%.*]], i64 [[D:%.*]], i32** nocapture nofree readnone [[E:%.*]]) {
2355; CHECK-NEXT:  entry:
2356; CHECK-NEXT:    tail call void @use_i32p(i32* [[A]])
2357; CHECK-NEXT:    tail call void @use_i32p(i32* [[A]])
2358; CHECK-NEXT:    ret void
2359;
2360entry:
2361  tail call void @use_i32p(i32* %a)
2362  tail call void @use_i32p(i32* %a)
2363  ret void
2364}
2365; FIXME: Figure out why the MODULE has the unused arguments still
2366define internal void @called_via_pointer_internal_2(i32* %a, i32* %b, i32* %c, i64 %d, i32** %e) {
2367; CHECK-LABEL: define {{[^@]+}}@called_via_pointer_internal_2
2368; CHECK-SAME: (i32* [[A:%.*]], i32* nocapture nofree readnone [[B:%.*]], i32* nocapture nofree readnone [[C:%.*]], i64 [[D:%.*]], i32** nocapture nofree readnone [[E:%.*]]) {
2369; CHECK-NEXT:  entry:
2370; CHECK-NEXT:    tail call void @use_i32p(i32* [[A]])
2371; CHECK-NEXT:    tail call void @use_i32p(i32* [[A]])
2372; CHECK-NEXT:    ret void
2373;
2374entry:
2375  tail call void @use_i32p(i32* %a)
2376  tail call void @use_i32p(i32* %a)
2377  ret void
2378}
2379declare void @use_i32p(i32*)
2380
2381; Allow blockaddress users
2382; NOT_CGSCC_OPM-NOT: @dead_with_blockaddress_users
2383define internal void @dead_with_blockaddress_users(i32* nocapture %pc) nounwind readonly {
2384; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@dead_with_blockaddress_users
2385; IS__CGSCC_OPM-SAME: (i32* nocapture [[PC:%.*]])
2386; IS__CGSCC_OPM-NEXT:  entry:
2387; IS__CGSCC_OPM-NEXT:    br label [[INDIRECTGOTO:%.*]]
2388; IS__CGSCC_OPM:       lab0:
2389; IS__CGSCC_OPM-NEXT:    [[INDVAR_NEXT:%.*]] = add i32 [[INDVAR:%.*]], 1
2390; IS__CGSCC_OPM-NEXT:    br label [[INDIRECTGOTO]]
2391; IS__CGSCC_OPM:       end:
2392; IS__CGSCC_OPM-NEXT:    ret void
2393; IS__CGSCC_OPM:       indirectgoto:
2394; IS__CGSCC_OPM-NEXT:    [[INDVAR]] = phi i32 [ [[INDVAR_NEXT]], [[LAB0:%.*]] ], [ 0, [[ENTRY:%.*]] ]
2395; IS__CGSCC_OPM-NEXT:    [[PC_ADDR_0:%.*]] = getelementptr i32, i32* [[PC]], i32 [[INDVAR]]
2396; IS__CGSCC_OPM-NEXT:    [[TMP1_PN:%.*]] = load i32, i32* [[PC_ADDR_0]]
2397; IS__CGSCC_OPM-NEXT:    [[INDIRECT_GOTO_DEST_IN:%.*]] = getelementptr inbounds [2 x i8*], [2 x i8*]* @dead_with_blockaddress_users.l, i32 0, i32 [[TMP1_PN]]
2398; IS__CGSCC_OPM-NEXT:    [[INDIRECT_GOTO_DEST:%.*]] = load i8*, i8** [[INDIRECT_GOTO_DEST_IN]]
2399; IS__CGSCC_OPM-NEXT:    indirectbr i8* [[INDIRECT_GOTO_DEST]], [label [[LAB0]], label %end]
2400;
2401entry:
2402  br label %indirectgoto
2403
2404lab0:                                             ; preds = %indirectgoto
2405  %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=1]
2406  br label %indirectgoto
2407
2408end:                                              ; preds = %indirectgoto
2409  ret void
2410
2411indirectgoto:                                     ; preds = %lab0, %entry
2412  %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2]
2413  %pc.addr.0 = getelementptr i32, i32* %pc, i32 %indvar ; <i32*> [#uses=1]
2414  %tmp1.pn = load i32, i32* %pc.addr.0                 ; <i32> [#uses=1]
2415  %indirect.goto.dest.in = getelementptr inbounds [2 x i8*], [2 x i8*]* @dead_with_blockaddress_users.l, i32 0, i32 %tmp1.pn ; <i8**> [#uses=1]
2416  %indirect.goto.dest = load i8*, i8** %indirect.goto.dest.in ; <i8*> [#uses=1]
2417  indirectbr i8* %indirect.goto.dest, [label %lab0, label %end]
2418}
2419
2420
2421; The code below exposed a bug that caused %call to be replaced with `undef`.
2422
2423%struct.a = type { %struct.a* }
2424
2425@e = global %struct.a* null
2426
2427define i32 @main() {
2428; CHECK-LABEL: define {{[^@]+}}@main() {
2429; CHECK-NEXT:  entry:
2430; CHECK-NEXT:    [[F:%.*]] = alloca i32, align 4
2431; CHECK-NEXT:    br label [[FOR_COND_0:%.*]]
2432; CHECK:       for.cond.0:
2433; CHECK-NEXT:    [[G_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY_0:%.*]] ]
2434; CHECK-NEXT:    [[CMP_0:%.*]] = icmp ult i32 [[G_0]], 100
2435; CHECK-NEXT:    br i1 [[CMP_0]], label [[FOR_BODY_0]], label [[FOR_END_0:%.*]]
2436; CHECK:       for.body.0:
2437; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[G_0]], 1
2438; CHECK-NEXT:    br label [[FOR_COND_0]]
2439; CHECK:       for.end.0:
2440; CHECK-NEXT:    [[CALL:%.*]] = call i8* @malloc(i64 noundef 8)
2441; CHECK-NEXT:    store i8* [[CALL]], i8** bitcast (%struct.a** @e to i8**), align 8
2442; CHECK-NEXT:    [[B:%.*]] = bitcast i8* [[CALL]] to %struct.a**
2443; CHECK-NEXT:    store %struct.a* null, %struct.a** [[B]], align 8
2444; CHECK-NEXT:    br label [[FOR_COND_1:%.*]]
2445; CHECK:       for.cond.1:
2446; CHECK-NEXT:    [[G_1:%.*]] = phi i32 [ 0, [[FOR_END_0]] ], [ [[INC6:%.*]], [[FOR_BODY_1:%.*]] ]
2447; CHECK-NEXT:    [[CMP_1:%.*]] = icmp ult i32 [[G_1]], 100
2448; CHECK-NEXT:    br i1 [[CMP_1]], label [[FOR_BODY_1]], label [[FOR_END_1:%.*]]
2449; CHECK:       for.body.1:
2450; CHECK-NEXT:    [[CALL4:%.*]] = call i32 (i32*, ...) bitcast (i32 (i32)* @h to i32 (i32*, ...)*)(i32* nonnull [[F]])
2451; CHECK-NEXT:    [[INC6]] = add nuw nsw i32 [[G_1]], 1
2452; CHECK-NEXT:    br label [[FOR_COND_1]]
2453; CHECK:       for.end.1:
2454; CHECK-NEXT:    ret i32 0
2455;
2456entry:
2457  %f = alloca i32
2458  br label %for.cond.0
2459
2460for.cond.0:
2461  %g.0 = phi i32 [ 0, %entry ], [ %inc, %for.body.0 ]
2462  %cmp.0 = icmp ult i32 %g.0, 100
2463  br i1 %cmp.0, label %for.body.0, label %for.end.0
2464
2465for.body.0:
2466  %inc = add nuw nsw i32 %g.0, 1
2467  br label %for.cond.0
2468
2469for.end.0:
2470  %call = call i8* @malloc(i64 8)
2471  store i8* %call, i8** bitcast (%struct.a** @e to i8**)
2472  %b = bitcast i8* %call to %struct.a**
2473  store %struct.a* null, %struct.a** %b
2474  br label %for.cond.1
2475
2476for.cond.1:
2477  %g.1 = phi i32 [ 0, %for.end.0 ], [ %inc6, %for.body.1 ]
2478  %cmp.1 = icmp ult i32 %g.1, 100
2479  br i1 %cmp.1, label %for.body.1, label %for.end.1
2480
2481for.body.1:
2482  %call4 = call i32 (i32*, ...) bitcast (i32 (i32)* @h to i32 (i32*, ...)*)(i32* nonnull %f)
2483  %inc6 = add nuw nsw i32 %g.1, 1
2484  br label %for.cond.1
2485
2486for.end.1:
2487  ret i32 0
2488}
2489
2490declare noalias i8* @malloc(i64)
2491
2492define i32 @h(i32 %i) {
2493; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2494; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@h
2495; NOT_CGSCC_NPM-SAME: (i32 [[I:%.*]]) [[ATTR12]] {
2496; NOT_CGSCC_NPM-NEXT:    ret i32 0
2497;
2498; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
2499; IS__CGSCC____-LABEL: define {{[^@]+}}@h
2500; IS__CGSCC____-SAME: (i32 [[I:%.*]]) [[ATTR6]] {
2501; IS__CGSCC____-NEXT:    ret i32 0
2502;
2503  ret i32 0
2504}
2505
2506
2507; Verify we do not choke on the GEP in the unreachable block.
2508
2509@p = global i8 0
2510
2511define void @bad_gep() {
2512; NOT_CGSCC_NPM: Function Attrs: nofree nosync nounwind readnone willreturn
2513; NOT_CGSCC_NPM-LABEL: define {{[^@]+}}@bad_gep
2514; NOT_CGSCC_NPM-SAME: () [[ATTR12]] {
2515; NOT_CGSCC_NPM-NEXT:  entry:
2516; NOT_CGSCC_NPM-NEXT:    [[N:%.*]] = alloca i8, align 1
2517; NOT_CGSCC_NPM-NEXT:    [[M:%.*]] = alloca i8, align 1
2518; NOT_CGSCC_NPM-NEXT:    call void @llvm.lifetime.start.p0i8(i64 noundef 1, i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[N]]) [[ATTR15:#.*]]
2519; NOT_CGSCC_NPM-NEXT:    br label [[EXIT:%.*]]
2520; NOT_CGSCC_NPM:       while.body:
2521; NOT_CGSCC_NPM-NEXT:    unreachable
2522; NOT_CGSCC_NPM:       if.then:
2523; NOT_CGSCC_NPM-NEXT:    unreachable
2524; NOT_CGSCC_NPM:       if.end:
2525; NOT_CGSCC_NPM-NEXT:    unreachable
2526; NOT_CGSCC_NPM:       exit:
2527; NOT_CGSCC_NPM-NEXT:    call void @llvm.lifetime.end.p0i8(i64 noundef 1, i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[N]]) [[ATTR15]]
2528; NOT_CGSCC_NPM-NEXT:    ret void
2529;
2530; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
2531; IS__CGSCC____-LABEL: define {{[^@]+}}@bad_gep
2532; IS__CGSCC____-SAME: () [[ATTR14:#.*]] {
2533; IS__CGSCC____-NEXT:  entry:
2534; IS__CGSCC____-NEXT:    [[N:%.*]] = alloca i8, align 1
2535; IS__CGSCC____-NEXT:    [[M:%.*]] = alloca i8, align 1
2536; IS__CGSCC____-NEXT:    call void @llvm.lifetime.start.p0i8(i64 noundef 1, i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[N]]) [[ATTR17:#.*]]
2537; IS__CGSCC____-NEXT:    br label [[EXIT:%.*]]
2538; IS__CGSCC____:       while.body:
2539; IS__CGSCC____-NEXT:    unreachable
2540; IS__CGSCC____:       if.then:
2541; IS__CGSCC____-NEXT:    unreachable
2542; IS__CGSCC____:       if.end:
2543; IS__CGSCC____-NEXT:    unreachable
2544; IS__CGSCC____:       exit:
2545; IS__CGSCC____-NEXT:    call void @llvm.lifetime.end.p0i8(i64 noundef 1, i8* noalias nocapture nofree noundef nonnull dereferenceable(1) [[N]]) [[ATTR17]]
2546; IS__CGSCC____-NEXT:    ret void
2547;
2548entry:
2549  %n = alloca i8
2550  %m = alloca i8
2551  call void @llvm.lifetime.start.p0i8(i64 1, i8* %n)
2552  br label %exit
2553
2554while.body:
2555  %call = call i1 @bad_gep_helper1(i8* %n, i8* %ptr, i8* %m)
2556  br i1 %call, label %if.then, label %if.end
2557
2558if.then:
2559  %0 = load i8, i8* %ptr
2560  call void @bad_gep_helper2(i8 %0)
2561  br label %if.end
2562
2563if.end:
2564  %ptr = getelementptr inbounds i8, i8* %ptr, i64 1
2565  %cmp = icmp eq i8* %ptr, @p
2566  br i1 %cmp, label %exit, label %while.body
2567
2568exit:
2569  call void @llvm.lifetime.end.p0i8(i64 1, i8* %n)
2570  ret void
2571}
2572
2573declare i1 @bad_gep_helper1(i8*, i8*, i8*)
2574declare void @bad_gep_helper2(i8)
2575
2576declare void @llvm.lifetime.start.p0i8(i64 %0, i8* %1)
2577declare void @llvm.lifetime.end.p0i8(i64 %0, i8* %1)
2578