2728 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4 5; NOT_CGSCC___: @dead_with_blockaddress_users.l = constant [2 x ptr] [ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr)]6; IS__CGSCC___: @dead_with_blockaddress_users.l = constant [2 x ptr] [ptr blockaddress(@dead_with_blockaddress_users, %lab0), ptr blockaddress(@dead_with_blockaddress_users, %end)]7@dead_with_blockaddress_users.l = constant [2 x ptr] [ptr blockaddress(@dead_with_blockaddress_users, %lab0), ptr blockaddress(@dead_with_blockaddress_users, %end)]8 9declare void @no_return_call() nofree noreturn nounwind nosync10 11declare void @normal_call() readnone12 13declare i32 @foo()14 15declare i32 @foo_nounwind() nounwind16 17declare i32 @foo_noreturn_nounwind() noreturn nounwind18 19declare i32 @foo_noreturn() noreturn20 21declare i32 @bar() nosync readnone22 23; This internal function has no live call sites, so all its BBs are considered dead,24; and nothing should be deduced for it.25 26;.27; TUNIT: @dead_with_blockaddress_users.l = constant [2 x ptr] [ptr inttoptr (i32 1 to ptr), ptr inttoptr (i32 1 to ptr)]28; TUNIT: @a1 = common global i8 0, align 829; TUNIT: @a2 = common global i8 0, align 1630; TUNIT: @e = global ptr null31; TUNIT: @p = global i8 032;.33; CGSCC: @dead_with_blockaddress_users.l = constant [2 x ptr] [ptr blockaddress(@dead_with_blockaddress_users, %lab0), ptr blockaddress(@dead_with_blockaddress_users, %end)]34; CGSCC: @a1 = common global i8 0, align 835; CGSCC: @a2 = common global i8 0, align 1636; CGSCC: @e = global ptr null37; CGSCC: @p = global i8 038;.39define internal i32 @dead_internal_func(i32 %0) {40; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)41; CGSCC-LABEL: define {{[^@]+}}@dead_internal_func42; CGSCC-SAME: () #[[ATTR6:[0-9]+]] {43; CGSCC-NEXT: br label [[TMP2:%.*]]44; CGSCC: 1:45; CGSCC-NEXT: ret i32 undef46; CGSCC: 2:47; CGSCC-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP6:%.*]], [[TMP2]] ], [ 1, [[TMP0:%.*]] ]48; CGSCC-NEXT: [[TMP4:%.*]] = phi i32 [ [[TMP5:%.*]], [[TMP2]] ], [ 1, [[TMP0]] ]49; CGSCC-NEXT: [[TMP5]] = mul nsw i32 [[TMP3]], [[TMP4]]50; CGSCC-NEXT: [[TMP6]] = add nuw nsw i32 [[TMP3]], 151; CGSCC-NEXT: [[TMP7:%.*]] = icmp eq i32 [[TMP3]], 1052; CGSCC-NEXT: br i1 [[TMP7]], label [[TMP1:%.*]], label [[TMP2]]53;54 %2 = icmp slt i32 %0, 155 br i1 %2, label %3, label %556 57; <label>:3: ; preds = %5, %158 %4 = phi i32 [ 1, %1 ], [ %8, %5 ]59 ret i32 %460 61; <label>:5: ; preds = %1, %562 %6 = phi i32 [ %9, %5 ], [ 1, %1 ]63 %7 = phi i32 [ %8, %5 ], [ 1, %1 ]64 %8 = mul nsw i32 %6, %765 %9 = add nuw nsw i32 %6, 166 %10 = icmp eq i32 %6, %067 br i1 %10, label %3, label %568}69 70define i32 @volatile_load(ptr) norecurse nounwind uwtable {71; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) uwtable72; TUNIT-LABEL: define {{[^@]+}}@volatile_load73; TUNIT-SAME: (ptr nofree noundef align 4 [[TMP0:%.*]]) #[[ATTR6:[0-9]+]] {74; TUNIT-NEXT: [[TMP2:%.*]] = load volatile i32, ptr [[TMP0]], align 475; TUNIT-NEXT: ret i32 [[TMP2]]76;77; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) uwtable78; CGSCC-LABEL: define {{[^@]+}}@volatile_load79; CGSCC-SAME: (ptr nofree noundef align 4 [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] {80; CGSCC-NEXT: [[TMP2:%.*]] = load volatile i32, ptr [[TMP0]], align 481; CGSCC-NEXT: ret i32 [[TMP2]]82;83 %2 = load volatile i32, ptr %0, align 484 ret i32 %285}86 87define internal i32 @internal_load(ptr) norecurse nounwind uwtable {88; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable89; CGSCC-LABEL: define {{[^@]+}}@internal_load90; CGSCC-SAME: () #[[ATTR8:[0-9]+]] {91; CGSCC-NEXT: ret i32 undef92;93 %2 = load i32, ptr %0, align 494 ret i32 %295}96; TEST 1: Only first block is live.97 98define i32 @first_block_no_return(i32 %a, ptr nonnull %ptr1, ptr %ptr2) #0 {99; TUNIT: Function Attrs: nofree noreturn nosync nounwind100; TUNIT-LABEL: define {{[^@]+}}@first_block_no_return101; TUNIT-SAME: (i32 [[A:%.*]], ptr nofree nonnull readnone captures(none) [[PTR1:%.*]], ptr nofree readnone captures(none) [[PTR2:%.*]]) #[[ATTR0:[0-9]+]] {102; TUNIT-NEXT: entry:103; TUNIT-NEXT: call void @no_return_call() #[[ATTR15:[0-9]+]]104; TUNIT-NEXT: unreachable105; TUNIT: cond.true:106; TUNIT-NEXT: unreachable107; TUNIT: cond.false:108; TUNIT-NEXT: unreachable109; TUNIT: cond.end:110; TUNIT-NEXT: unreachable111;112; CGSCC: Function Attrs: nofree noreturn nosync nounwind113; CGSCC-LABEL: define {{[^@]+}}@first_block_no_return114; CGSCC-SAME: (i32 [[A:%.*]], ptr nofree nonnull readnone captures(none) [[PTR1:%.*]], ptr nofree readnone captures(none) [[PTR2:%.*]]) #[[ATTR0:[0-9]+]] {115; CGSCC-NEXT: entry:116; CGSCC-NEXT: call void @no_return_call() #[[ATTR17:[0-9]+]]117; CGSCC-NEXT: unreachable118; CGSCC: cond.true:119; CGSCC-NEXT: unreachable120; CGSCC: cond.false:121; CGSCC-NEXT: unreachable122; CGSCC: cond.end:123; CGSCC-NEXT: unreachable124;125entry:126 call i32 @internal_load(ptr %ptr1)127 call void @no_return_call()128 call i32 @dead_internal_func(i32 10)129 %cmp = icmp eq i32 %a, 0130 br i1 %cmp, label %cond.true, label %cond.false131 132cond.true: ; preds = %entry133 call i32 @internal_load(ptr %ptr2)134 %load = call i32 @volatile_load(ptr %ptr1)135 call void @normal_call()136 %call = call i32 @foo()137 br label %cond.end138 139cond.false: ; preds = %entry140 call void @normal_call()141 %call1 = call i32 @bar()142 br label %cond.end143 144cond.end: ; preds = %cond.false, %cond.true145 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]146 ret i32 %cond147}148 149; TEST 2: cond.true is dead, but cond.end is not, since cond.false is live150 151; This is just an example. For example we can put a sync call in a152; dead block and check if it is deduced.153 154define i32 @dead_block_present(i32 %a, ptr %ptr1) #0 {155; TUNIT-LABEL: define {{[^@]+}}@dead_block_present156; TUNIT-SAME: (i32 [[A:%.*]], ptr nofree [[PTR1:%.*]]) {157; TUNIT-NEXT: entry:158; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0159; TUNIT-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]160; TUNIT: cond.true:161; TUNIT-NEXT: call void @no_return_call() #[[ATTR15]]162; TUNIT-NEXT: unreachable163; TUNIT: cond.false:164; TUNIT-NEXT: call void @normal_call()165; TUNIT-NEXT: [[CALL1:%.*]] = call i32 @bar()166; TUNIT-NEXT: br label [[COND_END:%.*]]167; TUNIT: cond.end:168; TUNIT-NEXT: ret i32 [[CALL1]]169;170; CGSCC-LABEL: define {{[^@]+}}@dead_block_present171; CGSCC-SAME: (i32 [[A:%.*]], ptr nofree [[PTR1:%.*]]) {172; CGSCC-NEXT: entry:173; CGSCC-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0174; CGSCC-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]175; CGSCC: cond.true:176; CGSCC-NEXT: call void @no_return_call() #[[ATTR17]]177; CGSCC-NEXT: unreachable178; CGSCC: cond.false:179; CGSCC-NEXT: call void @normal_call()180; CGSCC-NEXT: [[CALL1:%.*]] = call i32 @bar()181; CGSCC-NEXT: br label [[COND_END:%.*]]182; CGSCC: cond.end:183; CGSCC-NEXT: ret i32 [[CALL1]]184;185entry:186 %cmp = icmp eq i32 %a, 0187 br i1 %cmp, label %cond.true, label %cond.false188 189cond.true: ; preds = %entry190 call void @no_return_call()191 %call = call i32 @volatile_load(ptr %ptr1)192 br label %cond.end193 194cond.false: ; preds = %entry195 call void @normal_call()196 %call1 = call i32 @bar()197 br label %cond.end198 199cond.end: ; preds = %cond.false, %cond.true200 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]201 ret i32 %cond202}203 204; TEST 3: both cond.true and cond.false are dead, therfore cond.end is dead as well.205 206define i32 @all_dead(i32 %a) #0 {207; TUNIT: Function Attrs: noreturn208; TUNIT-LABEL: define {{[^@]+}}@all_dead209; TUNIT-SAME: (i32 [[A:%.*]]) #[[ATTR4:[0-9]+]] {210; TUNIT-NEXT: entry:211; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0212; TUNIT-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]213; TUNIT: cond.true:214; TUNIT-NEXT: call void @no_return_call() #[[ATTR15]]215; TUNIT-NEXT: unreachable216; TUNIT: cond.false:217; TUNIT-NEXT: call void @no_return_call() #[[ATTR3:[0-9]+]]218; TUNIT-NEXT: unreachable219; TUNIT: cond.end:220; TUNIT-NEXT: unreachable221;222; CGSCC: Function Attrs: noreturn223; CGSCC-LABEL: define {{[^@]+}}@all_dead224; CGSCC-SAME: (i32 [[A:%.*]]) #[[ATTR4:[0-9]+]] {225; CGSCC-NEXT: entry:226; CGSCC-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0227; CGSCC-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]228; CGSCC: cond.true:229; CGSCC-NEXT: call void @no_return_call() #[[ATTR17]]230; CGSCC-NEXT: unreachable231; CGSCC: cond.false:232; CGSCC-NEXT: call void @no_return_call() #[[ATTR3:[0-9]+]]233; CGSCC-NEXT: unreachable234; CGSCC: cond.end:235; CGSCC-NEXT: unreachable236;237entry:238 %cmp = icmp eq i32 %a, 0239 br i1 %cmp, label %cond.true, label %cond.false240 241cond.true: ; preds = %entry242 call void @no_return_call()243 call i32 @dead_internal_func(i32 10)244 %call = call i32 @foo()245 br label %cond.end246 247cond.false: ; preds = %entry248 call void @no_return_call()249 call i32 @dead_internal_func(i32 10)250 %call1 = call i32 @bar()251 br label %cond.end252 253cond.end: ; preds = %cond.false, %cond.true254 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]255 ret i32 %cond256}257 258declare i32 @__gxx_personality_v0(...)259 260; TEST 4: All blocks are live.261 262define i32 @all_live(i32 %a) #0 {263; CHECK-LABEL: define {{[^@]+}}@all_live264; CHECK-SAME: (i32 [[A:%.*]]) {265; CHECK-NEXT: entry:266; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0267; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]268; CHECK: cond.true:269; CHECK-NEXT: call void @normal_call()270; CHECK-NEXT: [[CALL:%.*]] = call i32 @foo_noreturn() #[[ATTR4:[0-9]+]]271; CHECK-NEXT: unreachable272; CHECK: cond.false:273; CHECK-NEXT: call void @normal_call()274; CHECK-NEXT: [[CALL1:%.*]] = call i32 @bar()275; CHECK-NEXT: br label [[COND_END:%.*]]276; CHECK: cond.end:277; CHECK-NEXT: ret i32 [[CALL1]]278;279entry:280 %cmp = icmp eq i32 %a, 0281 br i1 %cmp, label %cond.true, label %cond.false282 283cond.true: ; preds = %entry284 call void @normal_call()285 %call = call i32 @foo_noreturn()286 br label %cond.end287 288cond.false: ; preds = %entry289 call void @normal_call()290 %call1 = call i32 @bar()291 br label %cond.end292 293cond.end: ; preds = %cond.false, %cond.true294 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]295 ret i32 %cond296}297 298; TEST 5.1 noreturn invoke instruction with a unreachable normal successor block.299 300define i32 @invoke_noreturn(i32 %a) personality ptr @__gxx_personality_v0 {301; CHECK-LABEL: define {{[^@]+}}@invoke_noreturn302; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 {303; CHECK-NEXT: entry:304; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0305; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]306; CHECK: cond.true:307; CHECK-NEXT: call void @normal_call()308; CHECK-NEXT: [[CALL:%.*]] = invoke i32 @foo_noreturn() #[[ATTR4]]309; CHECK-NEXT: to label [[CONTINUE:%.*]] unwind label [[CLEANUP:%.*]]310; CHECK: cond.false:311; CHECK-NEXT: call void @normal_call()312; CHECK-NEXT: [[CALL1:%.*]] = call i32 @bar()313; CHECK-NEXT: br label [[COND_END:%.*]]314; CHECK: cond.end:315; CHECK-NEXT: ret i32 [[CALL1]]316; CHECK: continue:317; CHECK-NEXT: unreachable318; CHECK: cleanup:319; CHECK-NEXT: [[RES:%.*]] = landingpad { ptr, i32 }320; CHECK-NEXT: catch ptr null321; CHECK-NEXT: ret i32 0322;323entry:324 %cmp = icmp eq i32 %a, 0325 br i1 %cmp, label %cond.true, label %cond.false326 327cond.true: ; preds = %entry328 call void @normal_call()329 %call = invoke i32 @foo_noreturn() to label %continue330 unwind label %cleanup331 332cond.false: ; preds = %entry333 call void @normal_call()334 %call1 = call i32 @bar()335 br label %cond.end336 337cond.end: ; preds = %cond.false, %continue338 %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ]339 ret i32 %cond340 341continue:342 br label %cond.end343 344cleanup:345 %res = landingpad { ptr, i32 }346 catch ptr null347 ret i32 0348}349 350; TEST 5.2 noreturn invoke instruction replaced by a call and an unreachable instruction351; put after it.352 353define i32 @invoke_noreturn_nounwind(i32 %a) personality ptr @__gxx_personality_v0 {354; CHECK-LABEL: define {{[^@]+}}@invoke_noreturn_nounwind355; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 {356; CHECK-NEXT: entry:357; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0358; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]359; CHECK: cond.true:360; CHECK-NEXT: call void @normal_call()361; CHECK-NEXT: [[CALL:%.*]] = call i32 @foo_noreturn_nounwind() #[[ATTR3:[0-9]+]]362; CHECK-NEXT: unreachable363; CHECK: cond.false:364; CHECK-NEXT: call void @normal_call()365; CHECK-NEXT: [[CALL1:%.*]] = call i32 @bar()366; CHECK-NEXT: br label [[COND_END:%.*]]367; CHECK: cond.end:368; CHECK-NEXT: ret i32 [[CALL1]]369; CHECK: continue:370; CHECK-NEXT: unreachable371; CHECK: cleanup:372; CHECK-NEXT: unreachable373;374entry:375 %cmp = icmp eq i32 %a, 0376 br i1 %cmp, label %cond.true, label %cond.false377 378cond.true: ; preds = %entry379 call void @normal_call()380 %call = invoke i32 @foo_noreturn_nounwind() to label %continue381 unwind label %cleanup382 383 384cond.false: ; preds = %entry385 call void @normal_call()386 %call1 = call i32 @bar()387 br label %cond.end388 389cond.end: ; preds = %cond.false, %continue390 %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ]391 ret i32 %cond392 393continue:394 br label %cond.end395 396cleanup:397 %res = landingpad { ptr, i32 }398 catch ptr null399 ret i32 0400}401 402; TEST 5.3 unounwind invoke instruction replaced by a call and a branch instruction put after it.403define i32 @invoke_nounwind(i32 %a) personality ptr @__gxx_personality_v0 {404; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind405; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 {406; CHECK-NEXT: entry:407; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0408; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]409; CHECK: cond.true:410; CHECK-NEXT: call void @normal_call()411; CHECK-NEXT: [[CALL:%.*]] = call i32 @foo_nounwind() #[[ATTR2:[0-9]+]]412; CHECK-NEXT: br label [[CONTINUE:%.*]]413; CHECK: cond.false:414; CHECK-NEXT: call void @normal_call()415; CHECK-NEXT: [[CALL1:%.*]] = call i32 @bar()416; CHECK-NEXT: br label [[COND_END:%.*]]417; CHECK: cond.end:418; CHECK-NEXT: [[COND:%.*]] = phi i32 [ [[CALL]], [[CONTINUE]] ], [ [[CALL1]], [[COND_FALSE]] ]419; CHECK-NEXT: ret i32 [[COND]]420; CHECK: continue:421; CHECK-NEXT: br label [[COND_END]]422; CHECK: cleanup:423; CHECK-NEXT: unreachable424;425entry:426 %cmp = icmp eq i32 %a, 0427 br i1 %cmp, label %cond.true, label %cond.false428 429cond.true: ; preds = %entry430 call void @normal_call()431 %call = invoke i32 @foo_nounwind() to label %continue432 unwind label %cleanup433 434cond.false: ; preds = %entry435 call void @normal_call()436 %call1 = call i32 @bar()437 br label %cond.end438 439cond.end: ; preds = %cond.false, %continue440 %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ]441 ret i32 %cond442 443continue:444 br label %cond.end445 446cleanup:447 %res = landingpad { ptr, i32 }448 catch ptr null449 ret i32 0450}451 452; TEST 5.4 unounwind invoke instruction replaced by a call and a branch instruction put after it.453define i32 @invoke_nounwind_phi(i32 %a) personality ptr @__gxx_personality_v0 {454; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind_phi455; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 {456; CHECK-NEXT: entry:457; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0458; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]459; CHECK: cond.true:460; CHECK-NEXT: call void @normal_call()461; CHECK-NEXT: [[CALL:%.*]] = call i32 @foo_nounwind() #[[ATTR2]]462; CHECK-NEXT: br label [[CONTINUE:%.*]]463; CHECK: cond.false:464; CHECK-NEXT: call void @normal_call()465; CHECK-NEXT: [[CALL1:%.*]] = call i32 @bar()466; CHECK-NEXT: br label [[CONTINUE]]467; CHECK: continue:468; CHECK-NEXT: [[P:%.*]] = phi i32 [ 0, [[COND_TRUE]] ], [ 1, [[COND_FALSE]] ]469; CHECK-NEXT: ret i32 [[P]]470; CHECK: cleanup:471; CHECK-NEXT: unreachable472;473entry:474 %cmp = icmp eq i32 %a, 0475 br i1 %cmp, label %cond.true, label %cond.false476 477cond.true: ; preds = %entry478 call void @normal_call()479 %call = invoke i32 @foo_nounwind() to label %continue480 unwind label %cleanup481 482cond.false: ; preds = %entry483 call void @normal_call()484 %call1 = call i32 @bar()485 br label %continue486 487continue:488 %p = phi i32 [ 0, %cond.true ], [ 1, %cond.false ]489 ret i32 %p490 491cleanup:492 %res = landingpad { ptr, i32 } catch ptr null493 ret i32 0494}495 496; TEST 5.5 unounwind invoke instruction replaced by a call and a branch instruction put after it.497define i32 @invoke_nounwind_phi_dom(i32 %a) personality ptr @__gxx_personality_v0 {498; CHECK-LABEL: define {{[^@]+}}@invoke_nounwind_phi_dom499; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 {500; CHECK-NEXT: entry:501; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0502; CHECK-NEXT: br i1 [[CMP]], label [[COND_TRUE:%.*]], label [[COND_FALSE:%.*]]503; CHECK: cond.true:504; CHECK-NEXT: call void @normal_call()505; CHECK-NEXT: [[CALL:%.*]] = call i32 @foo_nounwind() #[[ATTR2]]506; CHECK-NEXT: br label [[CONTINUE:%.*]]507; CHECK: cond.false:508; CHECK-NEXT: call void @normal_call()509; CHECK-NEXT: [[CALL1:%.*]] = call i32 @bar()510; CHECK-NEXT: br label [[CONTINUE]]511; CHECK: continue:512; CHECK-NEXT: [[P:%.*]] = phi i32 [ [[CALL]], [[COND_TRUE]] ], [ [[CALL1]], [[COND_FALSE]] ]513; CHECK-NEXT: ret i32 [[P]]514; CHECK: cleanup:515; CHECK-NEXT: unreachable516;517entry:518 %cmp = icmp eq i32 %a, 0519 br i1 %cmp, label %cond.true, label %cond.false520 521cond.true: ; preds = %entry522 call void @normal_call()523 %call = invoke i32 @foo_nounwind() to label %continue524 unwind label %cleanup525 526cond.false: ; preds = %entry527 call void @normal_call()528 %call1 = call i32 @bar()529 br label %continue530 531continue:532 %p = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ]533 ret i32 %p534 535cleanup:536 %res = landingpad { ptr, i32 } catch ptr null537 ret i32 0538}539 540; TEST 6: Undefined behvior, taken from LangRef.541; FIXME: Should be able to detect undefined behavior.542 543define void @ub(ptr %0) {544; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)545; TUNIT-LABEL: define {{[^@]+}}@ub546; TUNIT-SAME: (ptr nofree writeonly captures(none) [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] {547; TUNIT-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1548; TUNIT-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0549; TUNIT-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, ptr [[TMP0]], i32 [[STILL_POISON]]550; TUNIT-NEXT: store i32 0, ptr [[POISON_YET_AGAIN]], align 4551; TUNIT-NEXT: ret void552;553; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)554; CGSCC-LABEL: define {{[^@]+}}@ub555; CGSCC-SAME: (ptr nofree writeonly captures(none) [[TMP0:%.*]]) #[[ATTR9:[0-9]+]] {556; CGSCC-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1557; CGSCC-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0558; CGSCC-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, ptr [[TMP0]], i32 [[STILL_POISON]]559; CGSCC-NEXT: store i32 0, ptr [[POISON_YET_AGAIN]], align 4560; CGSCC-NEXT: ret void561;562 %poison = sub nuw i32 0, 1 ; Results in a poison value.563 %still_poison = and i32 %poison, 0 ; 0, but also poison.564 %poison_yet_again = getelementptr i32, ptr %0, i32 %still_poison565 store i32 0, ptr %poison_yet_again ; Undefined behavior due to store to poison.566 ret void567}568 569define void @inf_loop() #0 {570; TUNIT: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none)571; TUNIT-LABEL: define {{[^@]+}}@inf_loop572; TUNIT-SAME: () #[[ATTR8:[0-9]+]] {573; TUNIT-NEXT: entry:574; TUNIT-NEXT: br label [[WHILE_BODY:%.*]]575; TUNIT: while.body:576; TUNIT-NEXT: br label [[WHILE_BODY]]577;578; CGSCC: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none)579; CGSCC-LABEL: define {{[^@]+}}@inf_loop580; CGSCC-SAME: () #[[ATTR10:[0-9]+]] {581; CGSCC-NEXT: entry:582; CGSCC-NEXT: br label [[WHILE_BODY:%.*]]583; CGSCC: while.body:584; CGSCC-NEXT: br label [[WHILE_BODY]]585;586entry:587 br label %while.body588 589while.body: ; preds = %entry, %while.body590 br label %while.body591}592 593; TEST 7: Infinite loop.594; FIXME: Detect infloops, and mark affected blocks dead.595 596define i32 @test5(i32, i32) #0 {597; TUNIT: Function Attrs: nosync memory(none)598; TUNIT-LABEL: define {{[^@]+}}@test5599; TUNIT-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {600; TUNIT-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]601; TUNIT-NEXT: br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]602; TUNIT: cond.if:603; TUNIT-NEXT: [[TMP4:%.*]] = tail call i32 @bar() #[[ATTR16:[0-9]+]]604; TUNIT-NEXT: br label [[COND_END:%.*]]605; TUNIT: cond.elseif:606; TUNIT-NEXT: unreachable607; TUNIT: cond.else:608; TUNIT-NEXT: unreachable609; TUNIT: cond.end:610; TUNIT-NEXT: ret i32 0611;612; CGSCC: Function Attrs: nosync memory(none)613; CGSCC-LABEL: define {{[^@]+}}@test5614; CGSCC-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR5:[0-9]+]] {615; CGSCC-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]616; CGSCC-NEXT: br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]617; CGSCC: cond.if:618; CGSCC-NEXT: [[TMP4:%.*]] = tail call i32 @bar() #[[ATTR18:[0-9]+]]619; CGSCC-NEXT: br label [[COND_END:%.*]]620; CGSCC: cond.elseif:621; CGSCC-NEXT: unreachable622; CGSCC: cond.else:623; CGSCC-NEXT: unreachable624; CGSCC: cond.end:625; CGSCC-NEXT: ret i32 0626;627 %3 = icmp sgt i32 %0, %1628 br i1 %3, label %cond.if, label %cond.elseif629 630cond.if: ; preds = %2631 %4 = tail call i32 @bar()632 br label %cond.end633 634cond.elseif: ; preds = %2635 call void @inf_loop()636 %5 = icmp slt i32 %0, %1637 br i1 %5, label %cond.end, label %cond.else638 639cond.else: ; preds = %cond.elseif640 %6 = tail call i32 @foo()641 br label %cond.end642 643cond.end: ; preds = %cond.if, %cond.else, %cond.elseif644 %7 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ]645 ret i32 %7646}647 648define void @rec() #0 {649; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)650; TUNIT-LABEL: define {{[^@]+}}@rec651; TUNIT-SAME: () #[[ATTR9:[0-9]+]] {652; TUNIT-NEXT: entry:653; TUNIT-NEXT: ret void654;655; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)656; CGSCC-LABEL: define {{[^@]+}}@rec657; CGSCC-SAME: () #[[ATTR11:[0-9]+]] {658; CGSCC-NEXT: entry:659; CGSCC-NEXT: ret void660;661entry:662 call void @rec()663 ret void664}665 666; TEST 8: Recursion667; FIXME: everything after first block should be marked dead668; and unreachable should be put after call to @rec().669 670define i32 @test6(i32, i32) #0 {671; CHECK-LABEL: define {{[^@]+}}@test6672; CHECK-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {673; CHECK-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]674; CHECK-NEXT: br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]675; CHECK: cond.if:676; CHECK-NEXT: [[TMP4:%.*]] = tail call i32 @bar()677; CHECK-NEXT: br label [[COND_END:%.*]]678; CHECK: cond.elseif:679; CHECK-NEXT: [[TMP5:%.*]] = icmp slt i32 [[TMP0]], [[TMP1]]680; CHECK-NEXT: br i1 [[TMP5]], label [[COND_END]], label [[COND_ELSE:%.*]]681; CHECK: cond.else:682; CHECK-NEXT: [[TMP6:%.*]] = tail call i32 @foo()683; CHECK-NEXT: br label [[COND_END]]684; CHECK: cond.end:685; CHECK-NEXT: [[TMP7:%.*]] = phi i32 [ [[TMP1]], [[COND_ELSEIF]] ], [ 0, [[COND_ELSE]] ], [ 0, [[COND_IF]] ]686; CHECK-NEXT: ret i32 [[TMP7]]687;688 call void @rec()689 %3 = icmp sgt i32 %0, %1690 br i1 %3, label %cond.if, label %cond.elseif691 692cond.if: ; preds = %2693 %4 = tail call i32 @bar()694 br label %cond.end695 696cond.elseif: ; preds = %2697 call void @rec()698 %5 = icmp slt i32 %0, %1699 br i1 %5, label %cond.end, label %cond.else700 701cond.else: ; preds = %cond.elseif702 %6 = tail call i32 @foo()703 br label %cond.end704 705cond.end: ; preds = %cond.if, %cond.else, %cond.elseif706 %7 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ]707 ret i32 %7708}709; TEST 9: Recursion710; FIXME: contains recursive call to itself in cond.elseif block711 712define i32 @test7(i32, i32) #0 {713; TUNIT-LABEL: define {{[^@]+}}@test7714; TUNIT-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {715; TUNIT-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]716; TUNIT-NEXT: br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]717; TUNIT: cond.if:718; TUNIT-NEXT: [[TMP4:%.*]] = tail call i32 @bar() #[[ATTR16]]719; TUNIT-NEXT: br label [[COND_END:%.*]]720; TUNIT: cond.elseif:721; TUNIT-NEXT: [[TMP5:%.*]] = tail call i32 @test7(i32 [[TMP0]], i32 [[TMP1]])722; TUNIT-NEXT: [[TMP6:%.*]] = icmp slt i32 [[TMP0]], [[TMP1]]723; TUNIT-NEXT: br i1 [[TMP6]], label [[COND_END]], label [[COND_ELSE:%.*]]724; TUNIT: cond.else:725; TUNIT-NEXT: [[TMP7:%.*]] = tail call i32 @foo()726; TUNIT-NEXT: br label [[COND_END]]727; TUNIT: cond.end:728; TUNIT-NEXT: [[TMP8:%.*]] = phi i32 [ [[TMP1]], [[COND_ELSEIF]] ], [ 0, [[COND_ELSE]] ], [ 0, [[COND_IF]] ]729; TUNIT-NEXT: ret i32 [[TMP8]]730;731; CGSCC-LABEL: define {{[^@]+}}@test7732; CGSCC-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) {733; CGSCC-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP0]], [[TMP1]]734; CGSCC-NEXT: br i1 [[TMP3]], label [[COND_IF:%.*]], label [[COND_ELSEIF:%.*]]735; CGSCC: cond.if:736; CGSCC-NEXT: [[TMP4:%.*]] = tail call i32 @bar() #[[ATTR18]]737; CGSCC-NEXT: br label [[COND_END:%.*]]738; CGSCC: cond.elseif:739; CGSCC-NEXT: [[TMP5:%.*]] = tail call i32 @test7(i32 [[TMP0]], i32 [[TMP1]])740; CGSCC-NEXT: [[TMP6:%.*]] = icmp slt i32 [[TMP0]], [[TMP1]]741; CGSCC-NEXT: br i1 [[TMP6]], label [[COND_END]], label [[COND_ELSE:%.*]]742; CGSCC: cond.else:743; CGSCC-NEXT: [[TMP7:%.*]] = tail call i32 @foo()744; CGSCC-NEXT: br label [[COND_END]]745; CGSCC: cond.end:746; CGSCC-NEXT: [[TMP8:%.*]] = phi i32 [ [[TMP1]], [[COND_ELSEIF]] ], [ 0, [[COND_ELSE]] ], [ 0, [[COND_IF]] ]747; CGSCC-NEXT: ret i32 [[TMP8]]748;749 %3 = icmp sgt i32 %0, %1750 br i1 %3, label %cond.if, label %cond.elseif751 752cond.if: ; preds = %2753 %4 = tail call i32 @bar()754 br label %cond.end755 756cond.elseif: ; preds = %2757 %5 = tail call i32 @test7(i32 %0, i32 %1)758 %6 = icmp slt i32 %0, %1759 br i1 %6, label %cond.end, label %cond.else760 761cond.else: ; preds = %cond.elseif762 %7 = tail call i32 @foo()763 br label %cond.end764 765cond.end: ; preds = %cond.if, %cond.else, %cond.elseif766 %8 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ]767 ret i32 %8768}769 770; SCC test771;772; char a1 __attribute__((aligned(8)));773; char a2 __attribute__((aligned(16)));774;775; char* f1(char* a ){776; return a?a:f2(&a1);777; }778; char* f2(char* a){779; return a?f1(a):f3(&a2);780; }781;782; char* f3(char* a){783; return a?&a1: f1(&a2);784; }785 786@a1 = common global i8 0, align 8787@a2 = common global i8 0, align 16788 789define internal ptr @f1(ptr readnone %0) local_unnamed_addr #0 {790; CGSCC-LABEL: define {{[^@]+}}@f1791; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr {792; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null793; CGSCC-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]794; CGSCC: 3:795; CGSCC-NEXT: [[TMP4:%.*]] = tail call ptr @f2(ptr nonnull @a1)796; CGSCC-NEXT: br label [[TMP5]]797; CGSCC: 5:798; CGSCC-NEXT: [[TMP6:%.*]] = phi ptr [ [[TMP4]], [[TMP3]] ], [ [[TMP0]], [[TMP1:%.*]] ]799; CGSCC-NEXT: ret ptr [[TMP6]]800;801 %2 = icmp eq ptr %0, null802 br i1 %2, label %3, label %5803 804; <label>:3: ; preds = %1805 %4 = tail call ptr @f2(ptr nonnull @a1)806 br label %5807 808; <label>:5: ; preds = %1, %3809 %6 = phi ptr [ %4, %3 ], [ %0, %1 ]810 ret ptr %6811}812 813define internal ptr @f2(ptr readnone %0) local_unnamed_addr #0 {814; CGSCC-LABEL: define {{[^@]+}}@f2815; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr {816; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null817; CGSCC-NEXT: br i1 [[TMP2]], label [[TMP5:%.*]], label [[TMP3:%.*]]818; CGSCC: 3:819; CGSCC-NEXT: [[TMP4:%.*]] = tail call ptr @f1(ptr nonnull [[TMP0]])820; CGSCC-NEXT: br label [[TMP7:%.*]]821; CGSCC: 5:822; CGSCC-NEXT: [[TMP6:%.*]] = tail call ptr @f3(ptr nonnull @a2)823; CGSCC-NEXT: br label [[TMP7]]824; CGSCC: 7:825; CGSCC-NEXT: [[TMP8:%.*]] = phi ptr [ [[TMP4]], [[TMP3]] ], [ [[TMP6]], [[TMP5]] ]826; CGSCC-NEXT: ret ptr [[TMP8]]827;828 %2 = icmp eq ptr %0, null829 br i1 %2, label %5, label %3830 831; <label>:3: ; preds = %1832 833 %4 = tail call ptr @f1(ptr nonnull %0)834 br label %7835 836; <label>:5: ; preds = %1837 %6 = tail call ptr @f3(ptr nonnull @a2)838 br label %7839 840; <label>:7: ; preds = %5, %3841 %8 = phi ptr [ %4, %3 ], [ %6, %5 ]842 ret ptr %8843}844 845define internal ptr @f3(ptr readnone %0) local_unnamed_addr #0 {846; CGSCC-LABEL: define {{[^@]+}}@f3847; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr {848; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null849; CGSCC-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP5:%.*]]850; CGSCC: 3:851; CGSCC-NEXT: [[TMP4:%.*]] = tail call ptr @f1(ptr nonnull @a2)852; CGSCC-NEXT: br label [[TMP5]]853; CGSCC: 5:854; CGSCC-NEXT: [[TMP6:%.*]] = phi ptr [ [[TMP4]], [[TMP3]] ], [ @a1, [[TMP1:%.*]] ]855; CGSCC-NEXT: ret ptr [[TMP6]]856;857 %2 = icmp eq ptr %0, null858 br i1 %2, label %3, label %5859 860; <label>:3: ; preds = %1861 %4 = tail call ptr @f1(ptr nonnull @a2)862 br label %5863 864; <label>:5: ; preds = %1, %3865 %6 = phi ptr [ %4, %3 ], [ @a1, %1 ]866 ret ptr %6867}868 869declare void @sink() nofree nosync nounwind willreturn870define void @test_unreachable() {871; TUNIT: Function Attrs: nofree noreturn nosync nounwind872; TUNIT-LABEL: define {{[^@]+}}@test_unreachable873; TUNIT-SAME: () #[[ATTR0]] {874; TUNIT-NEXT: call void @sink() #[[ATTR17:[0-9]+]]875; TUNIT-NEXT: call void @test_unreachable() #[[ATTR0]]876; TUNIT-NEXT: unreachable877;878; CGSCC: Function Attrs: nofree noreturn nosync nounwind879; CGSCC-LABEL: define {{[^@]+}}@test_unreachable880; CGSCC-SAME: () #[[ATTR0]] {881; CGSCC-NEXT: call void @sink() #[[ATTR19:[0-9]+]]882; CGSCC-NEXT: call void @test_unreachable() #[[ATTR0]]883; CGSCC-NEXT: unreachable884;885 call void @sink()886 call void @test_unreachable()887 unreachable888}889 890define linkonce_odr void @non_exact1() {891; CHECK-LABEL: define {{[^@]+}}@non_exact1() {892; CHECK-NEXT: call void @non_dead_a0() #[[ATTR2]]893; CHECK-NEXT: call void @non_dead_a1() #[[ATTR2]]894; CHECK-NEXT: call void @non_dead_a2() #[[ATTR2]]895; CHECK-NEXT: call void @non_dead_a3() #[[ATTR2]]896; CHECK-NEXT: call void @non_dead_a4() #[[ATTR2]]897; CHECK-NEXT: call void @non_dead_a5() #[[ATTR2]]898; CHECK-NEXT: call void @non_dead_a6() #[[ATTR2]]899; CHECK-NEXT: call void @non_dead_a7() #[[ATTR2]]900; CHECK-NEXT: call void @non_dead_a8() #[[ATTR2]]901; CHECK-NEXT: call void @non_dead_a9() #[[ATTR2]]902; CHECK-NEXT: call void @non_dead_a10() #[[ATTR2]]903; CHECK-NEXT: call void @non_dead_a11() #[[ATTR2]]904; CHECK-NEXT: call void @non_dead_a12() #[[ATTR2]]905; CHECK-NEXT: call void @non_dead_a13() #[[ATTR2]]906; CHECK-NEXT: call void @non_dead_a14() #[[ATTR2]]907; CHECK-NEXT: call void @non_dead_a15() #[[ATTR2]]908; CHECK-NEXT: call void @middle()909; CHECK-NEXT: ret void910;911 call void @non_dead_a0()912 call void @non_dead_a1()913 call void @non_dead_a2()914 call void @non_dead_a3()915 call void @non_dead_a4()916 call void @non_dead_a5()917 call void @non_dead_a6()918 call void @non_dead_a7()919 call void @non_dead_a8()920 call void @non_dead_a9()921 call void @non_dead_a10()922 call void @non_dead_a11()923 call void @non_dead_a12()924 call void @non_dead_a13()925 call void @non_dead_a14()926 call void @non_dead_a15()927 call void @middle()928 ret void929}930define internal void @middle() {931; TUNIT-LABEL: define {{[^@]+}}@middle() {932; TUNIT-NEXT: bb0:933; TUNIT-NEXT: call void @non_dead_b0() #[[ATTR10:[0-9]+]]934; TUNIT-NEXT: call void @non_dead_b1() #[[ATTR10]]935; TUNIT-NEXT: call void @non_dead_b2() #[[ATTR10]]936; TUNIT-NEXT: call void @non_dead_b3() #[[ATTR10]]937; TUNIT-NEXT: br label [[BB1:%.*]]938; TUNIT: bb1:939; TUNIT-NEXT: call void @non_dead_b4() #[[ATTR10]]940; TUNIT-NEXT: call void @non_dead_b5() #[[ATTR10]]941; TUNIT-NEXT: call void @non_dead_b6() #[[ATTR10]]942; TUNIT-NEXT: call void @non_dead_b7() #[[ATTR10]]943; TUNIT-NEXT: br label [[BB2:%.*]]944; TUNIT: bb2:945; TUNIT-NEXT: call void @non_dead_b8() #[[ATTR10]]946; TUNIT-NEXT: call void @non_dead_b9() #[[ATTR10]]947; TUNIT-NEXT: call void @non_dead_b10() #[[ATTR10]]948; TUNIT-NEXT: call void @non_dead_b11() #[[ATTR10]]949; TUNIT-NEXT: br label [[BB3:%.*]]950; TUNIT: bb3:951; TUNIT-NEXT: call void @non_dead_b12() #[[ATTR10]]952; TUNIT-NEXT: call void @non_dead_b13() #[[ATTR10]]953; TUNIT-NEXT: call void @non_dead_b14() #[[ATTR10]]954; TUNIT-NEXT: call void @non_dead_b15() #[[ATTR10]]955; TUNIT-NEXT: br label [[BB4:%.*]]956; TUNIT: bb4:957; TUNIT-NEXT: call void @non_exact2()958; TUNIT-NEXT: ret void959;960; CGSCC-LABEL: define {{[^@]+}}@middle() {961; CGSCC-NEXT: bb0:962; CGSCC-NEXT: call void @non_dead_b0() #[[ATTR19]]963; CGSCC-NEXT: call void @non_dead_b1() #[[ATTR19]]964; CGSCC-NEXT: call void @non_dead_b2() #[[ATTR19]]965; CGSCC-NEXT: call void @non_dead_b3() #[[ATTR19]]966; CGSCC-NEXT: br label [[BB1:%.*]]967; CGSCC: bb1:968; CGSCC-NEXT: call void @non_dead_b4() #[[ATTR19]]969; CGSCC-NEXT: call void @non_dead_b5() #[[ATTR19]]970; CGSCC-NEXT: call void @non_dead_b6() #[[ATTR19]]971; CGSCC-NEXT: call void @non_dead_b7() #[[ATTR19]]972; CGSCC-NEXT: br label [[BB2:%.*]]973; CGSCC: bb2:974; CGSCC-NEXT: call void @non_dead_b8() #[[ATTR19]]975; CGSCC-NEXT: call void @non_dead_b9() #[[ATTR19]]976; CGSCC-NEXT: call void @non_dead_b10() #[[ATTR19]]977; CGSCC-NEXT: call void @non_dead_b11() #[[ATTR19]]978; CGSCC-NEXT: br label [[BB3:%.*]]979; CGSCC: bb3:980; CGSCC-NEXT: call void @non_dead_b12() #[[ATTR19]]981; CGSCC-NEXT: call void @non_dead_b13() #[[ATTR19]]982; CGSCC-NEXT: call void @non_dead_b14() #[[ATTR19]]983; CGSCC-NEXT: call void @non_dead_b15() #[[ATTR19]]984; CGSCC-NEXT: br label [[BB4:%.*]]985; CGSCC: bb4:986; CGSCC-NEXT: call void @non_exact2()987; CGSCC-NEXT: ret void988;989bb0:990 call void @non_dead_b0()991 call void @non_dead_b1()992 call void @non_dead_b2()993 call void @non_dead_b3()994br label %bb1995bb1:996 call void @non_dead_b4()997 call void @non_dead_b5()998 call void @non_dead_b6()999 call void @non_dead_b7()1000br label %bb21001bb2:1002 call void @non_dead_b8()1003 call void @non_dead_b9()1004 call void @non_dead_b10()1005 call void @non_dead_b11()1006br label %bb31007bb3:1008 call void @non_dead_b12()1009 call void @non_dead_b13()1010 call void @non_dead_b14()1011 call void @non_dead_b15()1012br label %bb41013bb4:1014 call void @non_exact2()1015 ret void1016}1017define linkonce_odr void @non_exact2() {1018; CHECK-LABEL: define {{[^@]+}}@non_exact2() {1019; CHECK-NEXT: call void @non_dead_c0() #[[ATTR2]]1020; CHECK-NEXT: call void @non_dead_c1() #[[ATTR2]]1021; CHECK-NEXT: call void @non_dead_c2() #[[ATTR2]]1022; CHECK-NEXT: call void @non_dead_c3() #[[ATTR2]]1023; CHECK-NEXT: call void @non_dead_c4() #[[ATTR2]]1024; CHECK-NEXT: call void @non_dead_c5() #[[ATTR2]]1025; CHECK-NEXT: call void @non_dead_c6() #[[ATTR2]]1026; CHECK-NEXT: call void @non_dead_c7() #[[ATTR2]]1027; CHECK-NEXT: call void @non_dead_c8() #[[ATTR2]]1028; CHECK-NEXT: call void @non_dead_c9() #[[ATTR2]]1029; CHECK-NEXT: call void @non_dead_c10() #[[ATTR2]]1030; CHECK-NEXT: call void @non_dead_c11() #[[ATTR2]]1031; CHECK-NEXT: call void @non_dead_c12() #[[ATTR2]]1032; CHECK-NEXT: call void @non_dead_c13() #[[ATTR2]]1033; CHECK-NEXT: call void @non_dead_c14() #[[ATTR2]]1034; CHECK-NEXT: call void @non_dead_c15() #[[ATTR2]]1035; CHECK-NEXT: call void @non_exact3()1036; CHECK-NEXT: ret void1037;1038 call void @non_dead_c0()1039 call void @non_dead_c1()1040 call void @non_dead_c2()1041 call void @non_dead_c3()1042 call void @non_dead_c4()1043 call void @non_dead_c5()1044 call void @non_dead_c6()1045 call void @non_dead_c7()1046 call void @non_dead_c8()1047 call void @non_dead_c9()1048 call void @non_dead_c10()1049 call void @non_dead_c11()1050 call void @non_dead_c12()1051 call void @non_dead_c13()1052 call void @non_dead_c14()1053 call void @non_dead_c15()1054 call void @non_exact3()1055 ret void1056}1057define linkonce_odr void @non_exact3() {1058; CHECK-LABEL: define {{[^@]+}}@non_exact3() {1059; CHECK-NEXT: call void @non_dead_d0() #[[ATTR2]]1060; CHECK-NEXT: call void @non_dead_d1() #[[ATTR2]]1061; CHECK-NEXT: call void @non_dead_d2() #[[ATTR2]]1062; CHECK-NEXT: call void @non_dead_d3() #[[ATTR2]]1063; CHECK-NEXT: call void @non_dead_d4() #[[ATTR2]]1064; CHECK-NEXT: call void @non_dead_d5() #[[ATTR2]]1065; CHECK-NEXT: call void @non_dead_d6() #[[ATTR2]]1066; CHECK-NEXT: call void @non_dead_d7() #[[ATTR2]]1067; CHECK-NEXT: call void @non_dead_d8() #[[ATTR2]]1068; CHECK-NEXT: call void @non_dead_d9() #[[ATTR2]]1069; CHECK-NEXT: call void @non_dead_d10() #[[ATTR2]]1070; CHECK-NEXT: call void @non_dead_d11() #[[ATTR2]]1071; CHECK-NEXT: call void @non_dead_d12() #[[ATTR2]]1072; CHECK-NEXT: call void @non_dead_d13() #[[ATTR2]]1073; CHECK-NEXT: call void @non_dead_d14() #[[ATTR2]]1074; CHECK-NEXT: call void @non_dead_d15() #[[ATTR2]]1075; CHECK-NEXT: [[NR:%.*]] = call i32 @foo_noreturn()1076; CHECK-NEXT: ret void1077;1078 call void @non_dead_d0()1079 call void @non_dead_d1()1080 call void @non_dead_d2()1081 call void @non_dead_d3()1082 call void @non_dead_d4()1083 call void @non_dead_d5()1084 call void @non_dead_d6()1085 call void @non_dead_d7()1086 call void @non_dead_d8()1087 call void @non_dead_d9()1088 call void @non_dead_d10()1089 call void @non_dead_d11()1090 call void @non_dead_d12()1091 call void @non_dead_d13()1092 call void @non_dead_d14()1093 call void @non_dead_d15()1094 %nr = call i32 @foo_noreturn()1095 call void @dead_e1()1096 ret void1097}1098 1099define internal void @non_dead_a0() {1100; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1101; TUNIT-LABEL: define {{[^@]+}}@non_dead_a01102; TUNIT-SAME: () #[[ATTR11:[0-9]+]] {1103; TUNIT-NEXT: call void @sink() #[[ATTR17]]1104; TUNIT-NEXT: ret void1105;1106; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1107; CGSCC-LABEL: define {{[^@]+}}@non_dead_a01108; CGSCC-SAME: () #[[ATTR13:[0-9]+]] {1109; CGSCC-NEXT: call void @sink() #[[ATTR19]]1110; CGSCC-NEXT: ret void1111;1112 call void @sink()1113 ret void1114}1115define internal void @non_dead_a1() {1116; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1117; TUNIT-LABEL: define {{[^@]+}}@non_dead_a11118; TUNIT-SAME: () #[[ATTR11]] {1119; TUNIT-NEXT: call void @sink() #[[ATTR17]]1120; TUNIT-NEXT: ret void1121;1122; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1123; CGSCC-LABEL: define {{[^@]+}}@non_dead_a11124; CGSCC-SAME: () #[[ATTR13]] {1125; CGSCC-NEXT: call void @sink() #[[ATTR19]]1126; CGSCC-NEXT: ret void1127;1128 call void @sink()1129 ret void1130}1131define internal void @non_dead_a2() {1132; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1133; TUNIT-LABEL: define {{[^@]+}}@non_dead_a21134; TUNIT-SAME: () #[[ATTR11]] {1135; TUNIT-NEXT: call void @sink() #[[ATTR17]]1136; TUNIT-NEXT: ret void1137;1138; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1139; CGSCC-LABEL: define {{[^@]+}}@non_dead_a21140; CGSCC-SAME: () #[[ATTR13]] {1141; CGSCC-NEXT: call void @sink() #[[ATTR19]]1142; CGSCC-NEXT: ret void1143;1144 call void @sink()1145 ret void1146}1147define internal void @non_dead_a3() {1148; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1149; TUNIT-LABEL: define {{[^@]+}}@non_dead_a31150; TUNIT-SAME: () #[[ATTR11]] {1151; TUNIT-NEXT: call void @sink() #[[ATTR17]]1152; TUNIT-NEXT: ret void1153;1154; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1155; CGSCC-LABEL: define {{[^@]+}}@non_dead_a31156; CGSCC-SAME: () #[[ATTR13]] {1157; CGSCC-NEXT: call void @sink() #[[ATTR19]]1158; CGSCC-NEXT: ret void1159;1160 call void @sink()1161 ret void1162}1163define internal void @non_dead_a4() {1164; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1165; TUNIT-LABEL: define {{[^@]+}}@non_dead_a41166; TUNIT-SAME: () #[[ATTR11]] {1167; TUNIT-NEXT: call void @sink() #[[ATTR17]]1168; TUNIT-NEXT: ret void1169;1170; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1171; CGSCC-LABEL: define {{[^@]+}}@non_dead_a41172; CGSCC-SAME: () #[[ATTR13]] {1173; CGSCC-NEXT: call void @sink() #[[ATTR19]]1174; CGSCC-NEXT: ret void1175;1176 call void @sink()1177 ret void1178}1179define internal void @non_dead_a5() {1180; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1181; TUNIT-LABEL: define {{[^@]+}}@non_dead_a51182; TUNIT-SAME: () #[[ATTR11]] {1183; TUNIT-NEXT: call void @sink() #[[ATTR17]]1184; TUNIT-NEXT: ret void1185;1186; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1187; CGSCC-LABEL: define {{[^@]+}}@non_dead_a51188; CGSCC-SAME: () #[[ATTR13]] {1189; CGSCC-NEXT: call void @sink() #[[ATTR19]]1190; CGSCC-NEXT: ret void1191;1192 call void @sink()1193 ret void1194}1195define internal void @non_dead_a6() {1196; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1197; TUNIT-LABEL: define {{[^@]+}}@non_dead_a61198; TUNIT-SAME: () #[[ATTR11]] {1199; TUNIT-NEXT: call void @sink() #[[ATTR17]]1200; TUNIT-NEXT: ret void1201;1202; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1203; CGSCC-LABEL: define {{[^@]+}}@non_dead_a61204; CGSCC-SAME: () #[[ATTR13]] {1205; CGSCC-NEXT: call void @sink() #[[ATTR19]]1206; CGSCC-NEXT: ret void1207;1208 call void @sink()1209 ret void1210}1211define internal void @non_dead_a7() {1212; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1213; TUNIT-LABEL: define {{[^@]+}}@non_dead_a71214; TUNIT-SAME: () #[[ATTR11]] {1215; TUNIT-NEXT: call void @sink() #[[ATTR17]]1216; TUNIT-NEXT: ret void1217;1218; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1219; CGSCC-LABEL: define {{[^@]+}}@non_dead_a71220; CGSCC-SAME: () #[[ATTR13]] {1221; CGSCC-NEXT: call void @sink() #[[ATTR19]]1222; CGSCC-NEXT: ret void1223;1224 call void @sink()1225 ret void1226}1227define internal void @non_dead_a8() {1228; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1229; TUNIT-LABEL: define {{[^@]+}}@non_dead_a81230; TUNIT-SAME: () #[[ATTR11]] {1231; TUNIT-NEXT: call void @sink() #[[ATTR17]]1232; TUNIT-NEXT: ret void1233;1234; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1235; CGSCC-LABEL: define {{[^@]+}}@non_dead_a81236; CGSCC-SAME: () #[[ATTR13]] {1237; CGSCC-NEXT: call void @sink() #[[ATTR19]]1238; CGSCC-NEXT: ret void1239;1240 call void @sink()1241 ret void1242}1243define internal void @non_dead_a9() {1244; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1245; TUNIT-LABEL: define {{[^@]+}}@non_dead_a91246; TUNIT-SAME: () #[[ATTR11]] {1247; TUNIT-NEXT: call void @sink() #[[ATTR17]]1248; TUNIT-NEXT: ret void1249;1250; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1251; CGSCC-LABEL: define {{[^@]+}}@non_dead_a91252; CGSCC-SAME: () #[[ATTR13]] {1253; CGSCC-NEXT: call void @sink() #[[ATTR19]]1254; CGSCC-NEXT: ret void1255;1256 call void @sink()1257 ret void1258}1259define internal void @non_dead_a10() {1260; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1261; TUNIT-LABEL: define {{[^@]+}}@non_dead_a101262; TUNIT-SAME: () #[[ATTR11]] {1263; TUNIT-NEXT: call void @sink() #[[ATTR17]]1264; TUNIT-NEXT: ret void1265;1266; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1267; CGSCC-LABEL: define {{[^@]+}}@non_dead_a101268; CGSCC-SAME: () #[[ATTR13]] {1269; CGSCC-NEXT: call void @sink() #[[ATTR19]]1270; CGSCC-NEXT: ret void1271;1272 call void @sink()1273 ret void1274}1275define internal void @non_dead_a11() {1276; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1277; TUNIT-LABEL: define {{[^@]+}}@non_dead_a111278; TUNIT-SAME: () #[[ATTR11]] {1279; TUNIT-NEXT: call void @sink() #[[ATTR17]]1280; TUNIT-NEXT: ret void1281;1282; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1283; CGSCC-LABEL: define {{[^@]+}}@non_dead_a111284; CGSCC-SAME: () #[[ATTR13]] {1285; CGSCC-NEXT: call void @sink() #[[ATTR19]]1286; CGSCC-NEXT: ret void1287;1288 call void @sink()1289 ret void1290}1291define internal void @non_dead_a12() {1292; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1293; TUNIT-LABEL: define {{[^@]+}}@non_dead_a121294; TUNIT-SAME: () #[[ATTR11]] {1295; TUNIT-NEXT: call void @sink() #[[ATTR17]]1296; TUNIT-NEXT: ret void1297;1298; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1299; CGSCC-LABEL: define {{[^@]+}}@non_dead_a121300; CGSCC-SAME: () #[[ATTR13]] {1301; CGSCC-NEXT: call void @sink() #[[ATTR19]]1302; CGSCC-NEXT: ret void1303;1304 call void @sink()1305 ret void1306}1307define internal void @non_dead_a13() {1308; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1309; TUNIT-LABEL: define {{[^@]+}}@non_dead_a131310; TUNIT-SAME: () #[[ATTR11]] {1311; TUNIT-NEXT: call void @sink() #[[ATTR17]]1312; TUNIT-NEXT: ret void1313;1314; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1315; CGSCC-LABEL: define {{[^@]+}}@non_dead_a131316; CGSCC-SAME: () #[[ATTR13]] {1317; CGSCC-NEXT: call void @sink() #[[ATTR19]]1318; CGSCC-NEXT: ret void1319;1320 call void @sink()1321 ret void1322}1323define internal void @non_dead_a14() {1324; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1325; TUNIT-LABEL: define {{[^@]+}}@non_dead_a141326; TUNIT-SAME: () #[[ATTR11]] {1327; TUNIT-NEXT: call void @sink() #[[ATTR17]]1328; TUNIT-NEXT: ret void1329;1330; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1331; CGSCC-LABEL: define {{[^@]+}}@non_dead_a141332; CGSCC-SAME: () #[[ATTR13]] {1333; CGSCC-NEXT: call void @sink() #[[ATTR19]]1334; CGSCC-NEXT: ret void1335;1336 call void @sink()1337 ret void1338}1339define internal void @non_dead_a15() {1340; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1341; TUNIT-LABEL: define {{[^@]+}}@non_dead_a151342; TUNIT-SAME: () #[[ATTR11]] {1343; TUNIT-NEXT: call void @sink() #[[ATTR17]]1344; TUNIT-NEXT: ret void1345;1346; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1347; CGSCC-LABEL: define {{[^@]+}}@non_dead_a151348; CGSCC-SAME: () #[[ATTR13]] {1349; CGSCC-NEXT: call void @sink() #[[ATTR19]]1350; CGSCC-NEXT: ret void1351;1352 call void @sink()1353 ret void1354}1355define internal void @non_dead_b0() {1356; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1357; TUNIT-LABEL: define {{[^@]+}}@non_dead_b01358; TUNIT-SAME: () #[[ATTR11]] {1359; TUNIT-NEXT: call void @sink() #[[ATTR17]]1360; TUNIT-NEXT: ret void1361;1362; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1363; CGSCC-LABEL: define {{[^@]+}}@non_dead_b01364; CGSCC-SAME: () #[[ATTR13]] {1365; CGSCC-NEXT: call void @sink() #[[ATTR19]]1366; CGSCC-NEXT: ret void1367;1368 call void @sink()1369 ret void1370}1371define internal void @non_dead_b1() {1372; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1373; TUNIT-LABEL: define {{[^@]+}}@non_dead_b11374; TUNIT-SAME: () #[[ATTR11]] {1375; TUNIT-NEXT: call void @sink() #[[ATTR17]]1376; TUNIT-NEXT: ret void1377;1378; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1379; CGSCC-LABEL: define {{[^@]+}}@non_dead_b11380; CGSCC-SAME: () #[[ATTR13]] {1381; CGSCC-NEXT: call void @sink() #[[ATTR19]]1382; CGSCC-NEXT: ret void1383;1384 call void @sink()1385 ret void1386}1387define internal void @non_dead_b2() {1388; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1389; TUNIT-LABEL: define {{[^@]+}}@non_dead_b21390; TUNIT-SAME: () #[[ATTR11]] {1391; TUNIT-NEXT: call void @sink() #[[ATTR17]]1392; TUNIT-NEXT: ret void1393;1394; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1395; CGSCC-LABEL: define {{[^@]+}}@non_dead_b21396; CGSCC-SAME: () #[[ATTR13]] {1397; CGSCC-NEXT: call void @sink() #[[ATTR19]]1398; CGSCC-NEXT: ret void1399;1400 call void @sink()1401 ret void1402}1403define internal void @non_dead_b3() {1404; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1405; TUNIT-LABEL: define {{[^@]+}}@non_dead_b31406; TUNIT-SAME: () #[[ATTR11]] {1407; TUNIT-NEXT: call void @sink() #[[ATTR17]]1408; TUNIT-NEXT: ret void1409;1410; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1411; CGSCC-LABEL: define {{[^@]+}}@non_dead_b31412; CGSCC-SAME: () #[[ATTR13]] {1413; CGSCC-NEXT: call void @sink() #[[ATTR19]]1414; CGSCC-NEXT: ret void1415;1416 call void @sink()1417 ret void1418}1419define internal void @non_dead_b4() {1420; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1421; TUNIT-LABEL: define {{[^@]+}}@non_dead_b41422; TUNIT-SAME: () #[[ATTR11]] {1423; TUNIT-NEXT: call void @sink() #[[ATTR17]]1424; TUNIT-NEXT: ret void1425;1426; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1427; CGSCC-LABEL: define {{[^@]+}}@non_dead_b41428; CGSCC-SAME: () #[[ATTR13]] {1429; CGSCC-NEXT: call void @sink() #[[ATTR19]]1430; CGSCC-NEXT: ret void1431;1432 call void @sink()1433 ret void1434}1435define internal void @non_dead_b5() {1436; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1437; TUNIT-LABEL: define {{[^@]+}}@non_dead_b51438; TUNIT-SAME: () #[[ATTR11]] {1439; TUNIT-NEXT: call void @sink() #[[ATTR17]]1440; TUNIT-NEXT: ret void1441;1442; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1443; CGSCC-LABEL: define {{[^@]+}}@non_dead_b51444; CGSCC-SAME: () #[[ATTR13]] {1445; CGSCC-NEXT: call void @sink() #[[ATTR19]]1446; CGSCC-NEXT: ret void1447;1448 call void @sink()1449 ret void1450}1451define internal void @non_dead_b6() {1452; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1453; TUNIT-LABEL: define {{[^@]+}}@non_dead_b61454; TUNIT-SAME: () #[[ATTR11]] {1455; TUNIT-NEXT: call void @sink() #[[ATTR17]]1456; TUNIT-NEXT: ret void1457;1458; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1459; CGSCC-LABEL: define {{[^@]+}}@non_dead_b61460; CGSCC-SAME: () #[[ATTR13]] {1461; CGSCC-NEXT: call void @sink() #[[ATTR19]]1462; CGSCC-NEXT: ret void1463;1464 call void @sink()1465 ret void1466}1467define internal void @non_dead_b7() {1468; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1469; TUNIT-LABEL: define {{[^@]+}}@non_dead_b71470; TUNIT-SAME: () #[[ATTR11]] {1471; TUNIT-NEXT: call void @sink() #[[ATTR17]]1472; TUNIT-NEXT: ret void1473;1474; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1475; CGSCC-LABEL: define {{[^@]+}}@non_dead_b71476; CGSCC-SAME: () #[[ATTR13]] {1477; CGSCC-NEXT: call void @sink() #[[ATTR19]]1478; CGSCC-NEXT: ret void1479;1480 call void @sink()1481 ret void1482}1483define internal void @non_dead_b8() {1484; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1485; TUNIT-LABEL: define {{[^@]+}}@non_dead_b81486; TUNIT-SAME: () #[[ATTR11]] {1487; TUNIT-NEXT: call void @sink() #[[ATTR17]]1488; TUNIT-NEXT: ret void1489;1490; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1491; CGSCC-LABEL: define {{[^@]+}}@non_dead_b81492; CGSCC-SAME: () #[[ATTR13]] {1493; CGSCC-NEXT: call void @sink() #[[ATTR19]]1494; CGSCC-NEXT: ret void1495;1496 call void @sink()1497 ret void1498}1499define internal void @non_dead_b9() {1500; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1501; TUNIT-LABEL: define {{[^@]+}}@non_dead_b91502; TUNIT-SAME: () #[[ATTR11]] {1503; TUNIT-NEXT: call void @sink() #[[ATTR17]]1504; TUNIT-NEXT: ret void1505;1506; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1507; CGSCC-LABEL: define {{[^@]+}}@non_dead_b91508; CGSCC-SAME: () #[[ATTR13]] {1509; CGSCC-NEXT: call void @sink() #[[ATTR19]]1510; CGSCC-NEXT: ret void1511;1512 call void @sink()1513 ret void1514}1515define internal void @non_dead_b10() {1516; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1517; TUNIT-LABEL: define {{[^@]+}}@non_dead_b101518; TUNIT-SAME: () #[[ATTR11]] {1519; TUNIT-NEXT: call void @sink() #[[ATTR17]]1520; TUNIT-NEXT: ret void1521;1522; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1523; CGSCC-LABEL: define {{[^@]+}}@non_dead_b101524; CGSCC-SAME: () #[[ATTR13]] {1525; CGSCC-NEXT: call void @sink() #[[ATTR19]]1526; CGSCC-NEXT: ret void1527;1528 call void @sink()1529 ret void1530}1531define internal void @non_dead_b11() {1532; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1533; TUNIT-LABEL: define {{[^@]+}}@non_dead_b111534; TUNIT-SAME: () #[[ATTR11]] {1535; TUNIT-NEXT: call void @sink() #[[ATTR17]]1536; TUNIT-NEXT: ret void1537;1538; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1539; CGSCC-LABEL: define {{[^@]+}}@non_dead_b111540; CGSCC-SAME: () #[[ATTR13]] {1541; CGSCC-NEXT: call void @sink() #[[ATTR19]]1542; CGSCC-NEXT: ret void1543;1544 call void @sink()1545 ret void1546}1547define internal void @non_dead_b12() {1548; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1549; TUNIT-LABEL: define {{[^@]+}}@non_dead_b121550; TUNIT-SAME: () #[[ATTR11]] {1551; TUNIT-NEXT: call void @sink() #[[ATTR17]]1552; TUNIT-NEXT: ret void1553;1554; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1555; CGSCC-LABEL: define {{[^@]+}}@non_dead_b121556; CGSCC-SAME: () #[[ATTR13]] {1557; CGSCC-NEXT: call void @sink() #[[ATTR19]]1558; CGSCC-NEXT: ret void1559;1560 call void @sink()1561 ret void1562}1563define internal void @non_dead_b13() {1564; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1565; TUNIT-LABEL: define {{[^@]+}}@non_dead_b131566; TUNIT-SAME: () #[[ATTR11]] {1567; TUNIT-NEXT: call void @sink() #[[ATTR17]]1568; TUNIT-NEXT: ret void1569;1570; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1571; CGSCC-LABEL: define {{[^@]+}}@non_dead_b131572; CGSCC-SAME: () #[[ATTR13]] {1573; CGSCC-NEXT: call void @sink() #[[ATTR19]]1574; CGSCC-NEXT: ret void1575;1576 call void @sink()1577 ret void1578}1579define internal void @non_dead_b14() {1580; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1581; TUNIT-LABEL: define {{[^@]+}}@non_dead_b141582; TUNIT-SAME: () #[[ATTR11]] {1583; TUNIT-NEXT: call void @sink() #[[ATTR17]]1584; TUNIT-NEXT: ret void1585;1586; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1587; CGSCC-LABEL: define {{[^@]+}}@non_dead_b141588; CGSCC-SAME: () #[[ATTR13]] {1589; CGSCC-NEXT: call void @sink() #[[ATTR19]]1590; CGSCC-NEXT: ret void1591;1592 call void @sink()1593 ret void1594}1595define internal void @non_dead_b15() {1596; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1597; TUNIT-LABEL: define {{[^@]+}}@non_dead_b151598; TUNIT-SAME: () #[[ATTR11]] {1599; TUNIT-NEXT: call void @sink() #[[ATTR17]]1600; TUNIT-NEXT: ret void1601;1602; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1603; CGSCC-LABEL: define {{[^@]+}}@non_dead_b151604; CGSCC-SAME: () #[[ATTR13]] {1605; CGSCC-NEXT: call void @sink() #[[ATTR19]]1606; CGSCC-NEXT: ret void1607;1608 call void @sink()1609 ret void1610}1611define internal void @non_dead_c0() {1612; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1613; TUNIT-LABEL: define {{[^@]+}}@non_dead_c01614; TUNIT-SAME: () #[[ATTR11]] {1615; TUNIT-NEXT: call void @sink() #[[ATTR17]]1616; TUNIT-NEXT: ret void1617;1618; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1619; CGSCC-LABEL: define {{[^@]+}}@non_dead_c01620; CGSCC-SAME: () #[[ATTR13]] {1621; CGSCC-NEXT: call void @sink() #[[ATTR19]]1622; CGSCC-NEXT: ret void1623;1624 call void @sink()1625 ret void1626}1627define internal void @non_dead_c1() {1628; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1629; TUNIT-LABEL: define {{[^@]+}}@non_dead_c11630; TUNIT-SAME: () #[[ATTR11]] {1631; TUNIT-NEXT: call void @sink() #[[ATTR17]]1632; TUNIT-NEXT: ret void1633;1634; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1635; CGSCC-LABEL: define {{[^@]+}}@non_dead_c11636; CGSCC-SAME: () #[[ATTR13]] {1637; CGSCC-NEXT: call void @sink() #[[ATTR19]]1638; CGSCC-NEXT: ret void1639;1640 call void @sink()1641 ret void1642}1643define internal void @non_dead_c2() {1644; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1645; TUNIT-LABEL: define {{[^@]+}}@non_dead_c21646; TUNIT-SAME: () #[[ATTR11]] {1647; TUNIT-NEXT: call void @sink() #[[ATTR17]]1648; TUNIT-NEXT: ret void1649;1650; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1651; CGSCC-LABEL: define {{[^@]+}}@non_dead_c21652; CGSCC-SAME: () #[[ATTR13]] {1653; CGSCC-NEXT: call void @sink() #[[ATTR19]]1654; CGSCC-NEXT: ret void1655;1656 call void @sink()1657 ret void1658}1659define internal void @non_dead_c3() {1660; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1661; TUNIT-LABEL: define {{[^@]+}}@non_dead_c31662; TUNIT-SAME: () #[[ATTR11]] {1663; TUNIT-NEXT: call void @sink() #[[ATTR17]]1664; TUNIT-NEXT: ret void1665;1666; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1667; CGSCC-LABEL: define {{[^@]+}}@non_dead_c31668; CGSCC-SAME: () #[[ATTR13]] {1669; CGSCC-NEXT: call void @sink() #[[ATTR19]]1670; CGSCC-NEXT: ret void1671;1672 call void @sink()1673 ret void1674}1675define internal void @non_dead_c4() {1676; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1677; TUNIT-LABEL: define {{[^@]+}}@non_dead_c41678; TUNIT-SAME: () #[[ATTR11]] {1679; TUNIT-NEXT: call void @sink() #[[ATTR17]]1680; TUNIT-NEXT: ret void1681;1682; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1683; CGSCC-LABEL: define {{[^@]+}}@non_dead_c41684; CGSCC-SAME: () #[[ATTR13]] {1685; CGSCC-NEXT: call void @sink() #[[ATTR19]]1686; CGSCC-NEXT: ret void1687;1688 call void @sink()1689 ret void1690}1691define internal void @non_dead_c5() {1692; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1693; TUNIT-LABEL: define {{[^@]+}}@non_dead_c51694; TUNIT-SAME: () #[[ATTR11]] {1695; TUNIT-NEXT: call void @sink() #[[ATTR17]]1696; TUNIT-NEXT: ret void1697;1698; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1699; CGSCC-LABEL: define {{[^@]+}}@non_dead_c51700; CGSCC-SAME: () #[[ATTR13]] {1701; CGSCC-NEXT: call void @sink() #[[ATTR19]]1702; CGSCC-NEXT: ret void1703;1704 call void @sink()1705 ret void1706}1707define internal void @non_dead_c6() {1708; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1709; TUNIT-LABEL: define {{[^@]+}}@non_dead_c61710; TUNIT-SAME: () #[[ATTR11]] {1711; TUNIT-NEXT: call void @sink() #[[ATTR17]]1712; TUNIT-NEXT: ret void1713;1714; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1715; CGSCC-LABEL: define {{[^@]+}}@non_dead_c61716; CGSCC-SAME: () #[[ATTR13]] {1717; CGSCC-NEXT: call void @sink() #[[ATTR19]]1718; CGSCC-NEXT: ret void1719;1720 call void @sink()1721 ret void1722}1723define internal void @non_dead_c7() {1724; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1725; TUNIT-LABEL: define {{[^@]+}}@non_dead_c71726; TUNIT-SAME: () #[[ATTR11]] {1727; TUNIT-NEXT: call void @sink() #[[ATTR17]]1728; TUNIT-NEXT: ret void1729;1730; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1731; CGSCC-LABEL: define {{[^@]+}}@non_dead_c71732; CGSCC-SAME: () #[[ATTR13]] {1733; CGSCC-NEXT: call void @sink() #[[ATTR19]]1734; CGSCC-NEXT: ret void1735;1736 call void @sink()1737 ret void1738}1739define internal void @non_dead_c8() {1740; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1741; TUNIT-LABEL: define {{[^@]+}}@non_dead_c81742; TUNIT-SAME: () #[[ATTR11]] {1743; TUNIT-NEXT: call void @sink() #[[ATTR17]]1744; TUNIT-NEXT: ret void1745;1746; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1747; CGSCC-LABEL: define {{[^@]+}}@non_dead_c81748; CGSCC-SAME: () #[[ATTR13]] {1749; CGSCC-NEXT: call void @sink() #[[ATTR19]]1750; CGSCC-NEXT: ret void1751;1752 call void @sink()1753 ret void1754}1755define internal void @non_dead_c9() {1756; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1757; TUNIT-LABEL: define {{[^@]+}}@non_dead_c91758; TUNIT-SAME: () #[[ATTR11]] {1759; TUNIT-NEXT: call void @sink() #[[ATTR17]]1760; TUNIT-NEXT: ret void1761;1762; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1763; CGSCC-LABEL: define {{[^@]+}}@non_dead_c91764; CGSCC-SAME: () #[[ATTR13]] {1765; CGSCC-NEXT: call void @sink() #[[ATTR19]]1766; CGSCC-NEXT: ret void1767;1768 call void @sink()1769 ret void1770}1771define internal void @non_dead_c10() {1772; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1773; TUNIT-LABEL: define {{[^@]+}}@non_dead_c101774; TUNIT-SAME: () #[[ATTR11]] {1775; TUNIT-NEXT: call void @sink() #[[ATTR17]]1776; TUNIT-NEXT: ret void1777;1778; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1779; CGSCC-LABEL: define {{[^@]+}}@non_dead_c101780; CGSCC-SAME: () #[[ATTR13]] {1781; CGSCC-NEXT: call void @sink() #[[ATTR19]]1782; CGSCC-NEXT: ret void1783;1784 call void @sink()1785 ret void1786}1787define internal void @non_dead_c11() {1788; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1789; TUNIT-LABEL: define {{[^@]+}}@non_dead_c111790; TUNIT-SAME: () #[[ATTR11]] {1791; TUNIT-NEXT: call void @sink() #[[ATTR17]]1792; TUNIT-NEXT: ret void1793;1794; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1795; CGSCC-LABEL: define {{[^@]+}}@non_dead_c111796; CGSCC-SAME: () #[[ATTR13]] {1797; CGSCC-NEXT: call void @sink() #[[ATTR19]]1798; CGSCC-NEXT: ret void1799;1800 call void @sink()1801 ret void1802}1803define internal void @non_dead_c12() {1804; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1805; TUNIT-LABEL: define {{[^@]+}}@non_dead_c121806; TUNIT-SAME: () #[[ATTR11]] {1807; TUNIT-NEXT: call void @sink() #[[ATTR17]]1808; TUNIT-NEXT: ret void1809;1810; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1811; CGSCC-LABEL: define {{[^@]+}}@non_dead_c121812; CGSCC-SAME: () #[[ATTR13]] {1813; CGSCC-NEXT: call void @sink() #[[ATTR19]]1814; CGSCC-NEXT: ret void1815;1816 call void @sink()1817 ret void1818}1819define internal void @non_dead_c13() {1820; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1821; TUNIT-LABEL: define {{[^@]+}}@non_dead_c131822; TUNIT-SAME: () #[[ATTR11]] {1823; TUNIT-NEXT: call void @sink() #[[ATTR17]]1824; TUNIT-NEXT: ret void1825;1826; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1827; CGSCC-LABEL: define {{[^@]+}}@non_dead_c131828; CGSCC-SAME: () #[[ATTR13]] {1829; CGSCC-NEXT: call void @sink() #[[ATTR19]]1830; CGSCC-NEXT: ret void1831;1832 call void @sink()1833 ret void1834}1835define internal void @non_dead_c14() {1836; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1837; TUNIT-LABEL: define {{[^@]+}}@non_dead_c141838; TUNIT-SAME: () #[[ATTR11]] {1839; TUNIT-NEXT: call void @sink() #[[ATTR17]]1840; TUNIT-NEXT: ret void1841;1842; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1843; CGSCC-LABEL: define {{[^@]+}}@non_dead_c141844; CGSCC-SAME: () #[[ATTR13]] {1845; CGSCC-NEXT: call void @sink() #[[ATTR19]]1846; CGSCC-NEXT: ret void1847;1848 call void @sink()1849 ret void1850}1851define internal void @non_dead_c15() {1852; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1853; TUNIT-LABEL: define {{[^@]+}}@non_dead_c151854; TUNIT-SAME: () #[[ATTR11]] {1855; TUNIT-NEXT: call void @sink() #[[ATTR17]]1856; TUNIT-NEXT: ret void1857;1858; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1859; CGSCC-LABEL: define {{[^@]+}}@non_dead_c151860; CGSCC-SAME: () #[[ATTR13]] {1861; CGSCC-NEXT: call void @sink() #[[ATTR19]]1862; CGSCC-NEXT: ret void1863;1864 call void @sink()1865 ret void1866}1867define internal void @non_dead_d0() {1868; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1869; TUNIT-LABEL: define {{[^@]+}}@non_dead_d01870; TUNIT-SAME: () #[[ATTR11]] {1871; TUNIT-NEXT: call void @sink() #[[ATTR17]]1872; TUNIT-NEXT: ret void1873;1874; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1875; CGSCC-LABEL: define {{[^@]+}}@non_dead_d01876; CGSCC-SAME: () #[[ATTR13]] {1877; CGSCC-NEXT: call void @sink() #[[ATTR19]]1878; CGSCC-NEXT: ret void1879;1880 call void @sink()1881 ret void1882}1883define internal void @non_dead_d1() {1884; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1885; TUNIT-LABEL: define {{[^@]+}}@non_dead_d11886; TUNIT-SAME: () #[[ATTR11]] {1887; TUNIT-NEXT: call void @sink() #[[ATTR17]]1888; TUNIT-NEXT: ret void1889;1890; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1891; CGSCC-LABEL: define {{[^@]+}}@non_dead_d11892; CGSCC-SAME: () #[[ATTR13]] {1893; CGSCC-NEXT: call void @sink() #[[ATTR19]]1894; CGSCC-NEXT: ret void1895;1896 call void @sink()1897 ret void1898}1899define internal void @non_dead_d2() {1900; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1901; TUNIT-LABEL: define {{[^@]+}}@non_dead_d21902; TUNIT-SAME: () #[[ATTR11]] {1903; TUNIT-NEXT: call void @sink() #[[ATTR17]]1904; TUNIT-NEXT: ret void1905;1906; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1907; CGSCC-LABEL: define {{[^@]+}}@non_dead_d21908; CGSCC-SAME: () #[[ATTR13]] {1909; CGSCC-NEXT: call void @sink() #[[ATTR19]]1910; CGSCC-NEXT: ret void1911;1912 call void @sink()1913 ret void1914}1915define internal void @non_dead_d3() {1916; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1917; TUNIT-LABEL: define {{[^@]+}}@non_dead_d31918; TUNIT-SAME: () #[[ATTR11]] {1919; TUNIT-NEXT: call void @sink() #[[ATTR17]]1920; TUNIT-NEXT: ret void1921;1922; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1923; CGSCC-LABEL: define {{[^@]+}}@non_dead_d31924; CGSCC-SAME: () #[[ATTR13]] {1925; CGSCC-NEXT: call void @sink() #[[ATTR19]]1926; CGSCC-NEXT: ret void1927;1928 call void @sink()1929 ret void1930}1931define internal void @non_dead_d4() {1932; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1933; TUNIT-LABEL: define {{[^@]+}}@non_dead_d41934; TUNIT-SAME: () #[[ATTR11]] {1935; TUNIT-NEXT: call void @sink() #[[ATTR17]]1936; TUNIT-NEXT: ret void1937;1938; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1939; CGSCC-LABEL: define {{[^@]+}}@non_dead_d41940; CGSCC-SAME: () #[[ATTR13]] {1941; CGSCC-NEXT: call void @sink() #[[ATTR19]]1942; CGSCC-NEXT: ret void1943;1944 call void @sink()1945 ret void1946}1947define internal void @non_dead_d5() {1948; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1949; TUNIT-LABEL: define {{[^@]+}}@non_dead_d51950; TUNIT-SAME: () #[[ATTR11]] {1951; TUNIT-NEXT: call void @sink() #[[ATTR17]]1952; TUNIT-NEXT: ret void1953;1954; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1955; CGSCC-LABEL: define {{[^@]+}}@non_dead_d51956; CGSCC-SAME: () #[[ATTR13]] {1957; CGSCC-NEXT: call void @sink() #[[ATTR19]]1958; CGSCC-NEXT: ret void1959;1960 call void @sink()1961 ret void1962}1963define internal void @non_dead_d6() {1964; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1965; TUNIT-LABEL: define {{[^@]+}}@non_dead_d61966; TUNIT-SAME: () #[[ATTR11]] {1967; TUNIT-NEXT: call void @sink() #[[ATTR17]]1968; TUNIT-NEXT: ret void1969;1970; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1971; CGSCC-LABEL: define {{[^@]+}}@non_dead_d61972; CGSCC-SAME: () #[[ATTR13]] {1973; CGSCC-NEXT: call void @sink() #[[ATTR19]]1974; CGSCC-NEXT: ret void1975;1976 call void @sink()1977 ret void1978}1979define internal void @non_dead_d7() {1980; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1981; TUNIT-LABEL: define {{[^@]+}}@non_dead_d71982; TUNIT-SAME: () #[[ATTR11]] {1983; TUNIT-NEXT: call void @sink() #[[ATTR17]]1984; TUNIT-NEXT: ret void1985;1986; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn1987; CGSCC-LABEL: define {{[^@]+}}@non_dead_d71988; CGSCC-SAME: () #[[ATTR13]] {1989; CGSCC-NEXT: call void @sink() #[[ATTR19]]1990; CGSCC-NEXT: ret void1991;1992 call void @sink()1993 ret void1994}1995define internal void @non_dead_d8() {1996; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn1997; TUNIT-LABEL: define {{[^@]+}}@non_dead_d81998; TUNIT-SAME: () #[[ATTR11]] {1999; TUNIT-NEXT: call void @sink() #[[ATTR17]]2000; TUNIT-NEXT: ret void2001;2002; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2003; CGSCC-LABEL: define {{[^@]+}}@non_dead_d82004; CGSCC-SAME: () #[[ATTR13]] {2005; CGSCC-NEXT: call void @sink() #[[ATTR19]]2006; CGSCC-NEXT: ret void2007;2008 call void @sink()2009 ret void2010}2011define internal void @non_dead_d9() {2012; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2013; TUNIT-LABEL: define {{[^@]+}}@non_dead_d92014; TUNIT-SAME: () #[[ATTR11]] {2015; TUNIT-NEXT: call void @sink() #[[ATTR17]]2016; TUNIT-NEXT: ret void2017;2018; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2019; CGSCC-LABEL: define {{[^@]+}}@non_dead_d92020; CGSCC-SAME: () #[[ATTR13]] {2021; CGSCC-NEXT: call void @sink() #[[ATTR19]]2022; CGSCC-NEXT: ret void2023;2024 call void @sink()2025 ret void2026}2027define internal void @non_dead_d10() {2028; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2029; TUNIT-LABEL: define {{[^@]+}}@non_dead_d102030; TUNIT-SAME: () #[[ATTR11]] {2031; TUNIT-NEXT: call void @sink() #[[ATTR17]]2032; TUNIT-NEXT: ret void2033;2034; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2035; CGSCC-LABEL: define {{[^@]+}}@non_dead_d102036; CGSCC-SAME: () #[[ATTR13]] {2037; CGSCC-NEXT: call void @sink() #[[ATTR19]]2038; CGSCC-NEXT: ret void2039;2040 call void @sink()2041 ret void2042}2043define internal void @non_dead_d11() {2044; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2045; TUNIT-LABEL: define {{[^@]+}}@non_dead_d112046; TUNIT-SAME: () #[[ATTR11]] {2047; TUNIT-NEXT: call void @sink() #[[ATTR17]]2048; TUNIT-NEXT: ret void2049;2050; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2051; CGSCC-LABEL: define {{[^@]+}}@non_dead_d112052; CGSCC-SAME: () #[[ATTR13]] {2053; CGSCC-NEXT: call void @sink() #[[ATTR19]]2054; CGSCC-NEXT: ret void2055;2056 call void @sink()2057 ret void2058}2059define internal void @non_dead_d12() {2060; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2061; TUNIT-LABEL: define {{[^@]+}}@non_dead_d122062; TUNIT-SAME: () #[[ATTR11]] {2063; TUNIT-NEXT: call void @sink() #[[ATTR17]]2064; TUNIT-NEXT: ret void2065;2066; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2067; CGSCC-LABEL: define {{[^@]+}}@non_dead_d122068; CGSCC-SAME: () #[[ATTR13]] {2069; CGSCC-NEXT: call void @sink() #[[ATTR19]]2070; CGSCC-NEXT: ret void2071;2072 call void @sink()2073 ret void2074}2075define internal void @non_dead_d13() {2076; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2077; TUNIT-LABEL: define {{[^@]+}}@non_dead_d132078; TUNIT-SAME: () #[[ATTR11]] {2079; TUNIT-NEXT: call void @sink() #[[ATTR17]]2080; TUNIT-NEXT: ret void2081;2082; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2083; CGSCC-LABEL: define {{[^@]+}}@non_dead_d132084; CGSCC-SAME: () #[[ATTR13]] {2085; CGSCC-NEXT: call void @sink() #[[ATTR19]]2086; CGSCC-NEXT: ret void2087;2088 call void @sink()2089 ret void2090}2091define internal void @non_dead_d14() {2092; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2093; TUNIT-LABEL: define {{[^@]+}}@non_dead_d142094; TUNIT-SAME: () #[[ATTR11]] {2095; TUNIT-NEXT: call void @sink() #[[ATTR17]]2096; TUNIT-NEXT: ret void2097;2098; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2099; CGSCC-LABEL: define {{[^@]+}}@non_dead_d142100; CGSCC-SAME: () #[[ATTR13]] {2101; CGSCC-NEXT: call void @sink() #[[ATTR19]]2102; CGSCC-NEXT: ret void2103;2104 call void @sink()2105 ret void2106}2107define internal void @non_dead_d15() {2108; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2109; TUNIT-LABEL: define {{[^@]+}}@non_dead_d152110; TUNIT-SAME: () #[[ATTR11]] {2111; TUNIT-NEXT: call void @sink() #[[ATTR17]]2112; TUNIT-NEXT: ret void2113;2114; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2115; CGSCC-LABEL: define {{[^@]+}}@non_dead_d152116; CGSCC-SAME: () #[[ATTR13]] {2117; CGSCC-NEXT: call void @sink() #[[ATTR19]]2118; CGSCC-NEXT: ret void2119;2120 call void @sink()2121 ret void2122}2123define internal void @dead_e0() { call void @dead_e1() ret void }2124; CGSCC-LABEL: define {{[^@]+}}@dead_e0() {2125; CGSCC-NEXT: call void @dead_e1()2126; CGSCC-NEXT: ret void2127;2128define internal void @dead_e1() { call void @dead_e2() ret void }2129define internal void @dead_e2() { ret void }2130 2131; Verify we actually deduce information for these functions.2132 2133declare void @blowup() noreturn2134define void @live_with_dead_entry() personality ptr @__gxx_personality_v0 {2135entry:2136 invoke void @blowup() to label %live_with_dead_entry unwind label %lpad2137lpad:2138 %0 = landingpad { ptr, i32 } catch ptr null2139 br label %live_with_dead_entry2140live_with_dead_entry:2141 ret void2142}2143 2144define void @live_with_dead_entry_lp() personality ptr @__gxx_personality_v0 {2145; CHECK: Function Attrs: nounwind2146; CHECK-LABEL: define {{[^@]+}}@live_with_dead_entry_lp2147; CHECK-SAME: () #[[ATTR2]] personality ptr @__gxx_personality_v0 {2148; CHECK-NEXT: entry:2149; CHECK-NEXT: invoke void @blowup() #[[ATTR4]]2150; CHECK-NEXT: to label [[LIVE_WITH_DEAD_ENTRY_DEAD:%.*]] unwind label [[LP1:%.*]]2151; CHECK: lp1:2152; CHECK-NEXT: [[LP:%.*]] = landingpad { ptr, i32 }2153; CHECK-NEXT: catch ptr null2154; CHECK-NEXT: invoke void @blowup() #[[ATTR4]]2155; CHECK-NEXT: to label [[LIVE_WITH_DEAD_ENTRY_DEAD1:%.*]] unwind label [[LP2:%.*]]2156; CHECK: lp2:2157; CHECK-NEXT: [[TMP0:%.*]] = landingpad { ptr, i32 }2158; CHECK-NEXT: catch ptr null2159; CHECK-NEXT: br label [[LIVE_WITH_DEAD_ENTRY:%.*]]2160; CHECK: live_with_dead_entry.dead:2161; CHECK-NEXT: unreachable2162; CHECK: live_with_dead_entry.dead1:2163; CHECK-NEXT: unreachable2164; CHECK: live_with_dead_entry:2165; CHECK-NEXT: ret void2166;2167entry:2168 invoke void @blowup() to label %live_with_dead_entry unwind label %lp12169lp1:2170 %lp = landingpad { ptr, i32 } catch ptr null2171 invoke void @blowup() to label %live_with_dead_entry unwind label %lp22172lp2:2173 %0 = landingpad { ptr, i32 } catch ptr null2174 br label %live_with_dead_entry2175live_with_dead_entry:2176 ret void2177}2178 2179define internal void @useless_arg_sink(ptr %a) {2180; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none)2181; TUNIT-LABEL: define {{[^@]+}}@useless_arg_sink2182; TUNIT-SAME: () #[[ATTR12:[0-9]+]] {2183; TUNIT-NEXT: call void @sink() #[[ATTR17]]2184; TUNIT-NEXT: ret void2185;2186; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none)2187; CGSCC-LABEL: define {{[^@]+}}@useless_arg_sink2188; CGSCC-SAME: () #[[ATTR14:[0-9]+]] {2189; CGSCC-NEXT: call void @sink() #[[ATTR19]]2190; CGSCC-NEXT: ret void2191;2192 call void @sink()2193 ret void2194}2195 2196define internal void @useless_arg_almost_sink(ptr %a) {2197; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none)2198; TUNIT-LABEL: define {{[^@]+}}@useless_arg_almost_sink2199; TUNIT-SAME: () #[[ATTR12]] {2200; TUNIT-NEXT: call void @useless_arg_sink() #[[ATTR10]]2201; TUNIT-NEXT: ret void2202;2203; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none)2204; CGSCC-LABEL: define {{[^@]+}}@useless_arg_almost_sink2205; CGSCC-SAME: () #[[ATTR14]] {2206; CGSCC-NEXT: call void @useless_arg_sink() #[[ATTR19]]2207; CGSCC-NEXT: ret void2208;2209 call void @useless_arg_sink(ptr %a)2210 ret void2211}2212 2213; Check we do not annotate the function interface of this weak function.2214define weak_odr void @useless_arg_ext(ptr %a) {2215; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext2216; CHECK-SAME: (ptr [[A:%.*]]) {2217; CHECK-NEXT: call void @useless_arg_almost_sink() #[[ATTR2]]2218; CHECK-NEXT: ret void2219;2220 call void @useless_arg_almost_sink(ptr %a)2221 ret void2222}2223 2224define internal void @useless_arg_ext_int(ptr %a) {2225; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext_int2226; CHECK-SAME: (ptr [[A:%.*]]) {2227; CHECK-NEXT: call void @useless_arg_ext(ptr [[A]])2228; CHECK-NEXT: ret void2229;2230 call void @useless_arg_ext(ptr %a)2231 ret void2232}2233 2234define void @useless_arg_ext_int_ext(ptr %a) {2235; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext_int_ext2236; CHECK-SAME: (ptr [[A:%.*]]) {2237; CHECK-NEXT: call void @useless_arg_ext_int(ptr [[A]])2238; CHECK-NEXT: ret void2239;2240 call void @useless_arg_ext_int(ptr %a)2241 ret void2242}2243 2244; FIXME: We should fold terminators.2245 2246define internal i32 @switch_default(i64 %i) nounwind {2247; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none)2248; TUNIT-LABEL: define {{[^@]+}}@switch_default2249; TUNIT-SAME: () #[[ATTR12]] {2250; TUNIT-NEXT: entry:2251; TUNIT-NEXT: switch i64 0, label [[SW_DEFAULT:%.*]] [2252; TUNIT-NEXT: i64 3, label [[RETURN:%.*]]2253; TUNIT-NEXT: i64 10, label [[RETURN]]2254; TUNIT-NEXT: ]2255; TUNIT: sw.default:2256; TUNIT-NEXT: call void @sink() #[[ATTR17]]2257; TUNIT-NEXT: ret i32 undef2258; TUNIT: return:2259; TUNIT-NEXT: unreachable2260;2261; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none)2262; CGSCC-LABEL: define {{[^@]+}}@switch_default2263; CGSCC-SAME: () #[[ATTR14]] {2264; CGSCC-NEXT: entry:2265; CGSCC-NEXT: switch i64 0, label [[SW_DEFAULT:%.*]] [2266; CGSCC-NEXT: i64 3, label [[RETURN:%.*]]2267; CGSCC-NEXT: i64 10, label [[RETURN]]2268; CGSCC-NEXT: ]2269; CGSCC: sw.default:2270; CGSCC-NEXT: call void @sink() #[[ATTR19]]2271; CGSCC-NEXT: ret i32 1232272; CGSCC: return:2273; CGSCC-NEXT: unreachable2274;2275entry:2276 switch i64 %i, label %sw.default [2277 i64 3, label %return2278 i64 10, label %return2279 ]2280 2281sw.default:2282 call void @sink()2283 ret i32 1232284 2285return:2286 ret i32 02287}2288 2289define i32 @switch_default_caller() {2290; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn2291; TUNIT-LABEL: define {{[^@]+}}@switch_default_caller2292; TUNIT-SAME: () #[[ATTR11]] {2293; TUNIT-NEXT: [[CALL2:%.*]] = tail call i32 @switch_default() #[[ATTR10]]2294; TUNIT-NEXT: ret i32 1232295;2296; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn2297; CGSCC-LABEL: define {{[^@]+}}@switch_default_caller2298; CGSCC-SAME: () #[[ATTR13]] {2299; CGSCC-NEXT: [[CALL2:%.*]] = tail call noundef i32 @switch_default() #[[ATTR19]]2300; CGSCC-NEXT: ret i32 [[CALL2]]2301;2302 %call2 = tail call i32 @switch_default(i64 0)2303 ret i32 %call22304}2305 2306define internal i32 @switch_default_dead(i64 %i) nounwind {2307; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2308; CGSCC-LABEL: define {{[^@]+}}@switch_default_dead2309; CGSCC-SAME: () #[[ATTR6]] {2310; CGSCC-NEXT: entry:2311; CGSCC-NEXT: switch i64 0, label [[SW_DEFAULT:%.*]] [2312; CGSCC-NEXT: i64 3, label [[RETURN:%.*]]2313; CGSCC-NEXT: i64 10, label [[RETURN]]2314; CGSCC-NEXT: ]2315; CGSCC: sw.default:2316; CGSCC-NEXT: ret i32 1232317; CGSCC: return:2318; CGSCC-NEXT: unreachable2319;2320entry:2321 switch i64 %i, label %sw.default [2322 i64 3, label %return2323 i64 10, label %return2324 ]2325 2326sw.default:2327 ret i32 1232328 2329return:2330 ret i32 02331}2332 2333define i32 @switch_default_dead_caller() {2334; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2335; TUNIT-LABEL: define {{[^@]+}}@switch_default_dead_caller2336; TUNIT-SAME: () #[[ATTR13:[0-9]+]] {2337; TUNIT-NEXT: ret i32 1232338;2339; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)2340; CGSCC-LABEL: define {{[^@]+}}@switch_default_dead_caller2341; CGSCC-SAME: () #[[ATTR11]] {2342; CGSCC-NEXT: [[CALL2:%.*]] = tail call noundef i32 @switch_default_dead() #[[ATTR20:[0-9]+]]2343; CGSCC-NEXT: ret i32 [[CALL2]]2344;2345 %call2 = tail call i32 @switch_default_dead(i64 0)2346 ret i32 %call22347}2348 2349define void @call_via_pointer_with_dead_args(ptr %a, ptr %b, ptr %fp) {2350; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args2351; CHECK-SAME: (ptr [[A:%.*]], ptr [[B:%.*]], ptr nofree noundef nonnull captures(none) [[FP:%.*]]) {2352; CHECK-NEXT: call void [[FP]](ptr [[A]], ptr [[B]], ptr [[A]], i64 -1, ptr null)2353; CHECK-NEXT: ret void2354;2355 call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null)2356 ret void2357}2358 2359define internal void @call_via_pointer_with_dead_args_internal_a(ptr %a, ptr %b, ptr %fp) {2360; TUNIT-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a2361; TUNIT-SAME: (ptr [[A:%.*]], ptr noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {2362; TUNIT-NEXT: call void @called_via_pointer(ptr [[A]], ptr nonnull align 128 dereferenceable(4) [[B]], ptr [[A]], i64 -1, ptr null)2363; TUNIT-NEXT: ret void2364;2365; CGSCC-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a2366; CGSCC-SAME: (ptr [[A:%.*]], ptr noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {2367; CGSCC-NEXT: call void @called_via_pointer(ptr [[A]], ptr nofree noundef nonnull align 128 captures(none) dereferenceable(4) [[B]], ptr nofree captures(none) [[A]], i64 noundef -1, ptr nofree noundef null)2368; CGSCC-NEXT: ret void2369;2370 call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null)2371 ret void2372}2373define internal void @call_via_pointer_with_dead_args_internal_b(ptr %a, ptr %b, ptr %fp) {2374; TUNIT-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b2375; TUNIT-SAME: (ptr [[A:%.*]], ptr noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {2376; TUNIT-NEXT: call void @called_via_pointer_internal_2(ptr [[A]], ptr nonnull align 128 dereferenceable(4) [[B]], ptr [[A]], i64 -1, ptr null)2377; TUNIT-NEXT: ret void2378;2379; CGSCC-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b2380; CGSCC-SAME: (ptr [[A:%.*]], ptr noundef nonnull align 128 dereferenceable(4) [[B:%.*]]) {2381; CGSCC-NEXT: call void @called_via_pointer_internal_2(ptr [[A]])2382; CGSCC-NEXT: ret void2383;2384 call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null)2385 ret void2386}2387define void @call_via_pointer_with_dead_args_caller(ptr %a, ptr %b) {2388; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_caller2389; CHECK-SAME: (ptr [[A:%.*]], ptr [[B:%.*]]) {2390; CHECK-NEXT: [[PTR1:%.*]] = alloca i32, align 1282391; CHECK-NEXT: [[PTR2:%.*]] = alloca i32, align 1282392; CHECK-NEXT: [[PTR3:%.*]] = alloca i32, align 1282393; CHECK-NEXT: [[PTR4:%.*]] = alloca i32, align 1282394; CHECK-NEXT: call void @call_via_pointer_with_dead_args(ptr [[A]], ptr noundef nonnull align 128 dereferenceable(4) [[PTR1]], ptr nofree noundef nonnull captures(none) @called_via_pointer)2395; CHECK-NEXT: call void @call_via_pointer_with_dead_args(ptr [[A]], ptr noundef nonnull align 128 dereferenceable(4) [[PTR2]], ptr nofree noundef nonnull captures(none) @called_via_pointer_internal_1)2396; CHECK-NEXT: call void @call_via_pointer_with_dead_args_internal_a(ptr [[B]], ptr noundef nonnull align 128 dereferenceable(4) [[PTR3]])2397; CHECK-NEXT: call void @call_via_pointer_with_dead_args_internal_b(ptr [[B]], ptr noundef nonnull align 128 dereferenceable(4) [[PTR4]])2398; CHECK-NEXT: ret void2399;2400 %ptr1 = alloca i32, align 1282401 %ptr2 = alloca i32, align 1282402 %ptr3 = alloca i32, align 1282403 %ptr4 = alloca i32, align 1282404 call void @call_via_pointer_with_dead_args(ptr %a, ptr %ptr1, ptr @called_via_pointer)2405 call void @call_via_pointer_with_dead_args(ptr %a, ptr %ptr2, ptr @called_via_pointer_internal_1)2406 call void @call_via_pointer_with_dead_args_internal_a(ptr %b, ptr %ptr3, ptr @called_via_pointer)2407 call void @call_via_pointer_with_dead_args_internal_b(ptr %b, ptr %ptr4, ptr @called_via_pointer_internal_2)2408 ret void2409}2410define void @called_via_pointer(ptr %a, ptr %b, ptr %c, i64 %d, ptr %e) {2411; CHECK-LABEL: define {{[^@]+}}@called_via_pointer2412; CHECK-SAME: (ptr [[A:%.*]], ptr nofree readnone captures(none) [[B:%.*]], ptr nofree readnone captures(none) [[C:%.*]], i64 [[D:%.*]], ptr nofree readnone captures(none) [[E:%.*]]) {2413; CHECK-NEXT: entry:2414; CHECK-NEXT: tail call void @use_i32p(ptr [[A]])2415; CHECK-NEXT: tail call void @use_i32p(ptr [[A]])2416; CHECK-NEXT: ret void2417;2418entry:2419 tail call void @use_i32p(ptr %a)2420 tail call void @use_i32p(ptr %a)2421 ret void2422}2423define internal void @called_via_pointer_internal_1(ptr %a, ptr %b, ptr %c, i64 %d, ptr %e) {2424; CHECK-LABEL: define {{[^@]+}}@called_via_pointer_internal_12425; CHECK-SAME: (ptr [[A:%.*]], ptr nofree readnone captures(none) [[B:%.*]], ptr nofree readnone captures(none) [[C:%.*]], i64 [[D:%.*]], ptr nofree readnone captures(none) [[E:%.*]]) {2426; CHECK-NEXT: entry:2427; CHECK-NEXT: tail call void @use_i32p(ptr [[A]])2428; CHECK-NEXT: tail call void @use_i32p(ptr [[A]])2429; CHECK-NEXT: ret void2430;2431entry:2432 tail call void @use_i32p(ptr %a)2433 tail call void @use_i32p(ptr %a)2434 ret void2435}2436; FIXME: Figure out why the MODULE has the unused arguments still2437define internal void @called_via_pointer_internal_2(ptr %a, ptr %b, ptr %c, i64 %d, ptr %e) {2438; TUNIT-LABEL: define {{[^@]+}}@called_via_pointer_internal_22439; TUNIT-SAME: (ptr [[A:%.*]], ptr nofree readnone captures(none) [[B:%.*]], ptr nofree readnone captures(none) [[C:%.*]], i64 [[D:%.*]], ptr nofree readnone captures(none) [[E:%.*]]) {2440; TUNIT-NEXT: entry:2441; TUNIT-NEXT: tail call void @use_i32p(ptr [[A]])2442; TUNIT-NEXT: tail call void @use_i32p(ptr [[A]])2443; TUNIT-NEXT: ret void2444;2445; CGSCC-LABEL: define {{[^@]+}}@called_via_pointer_internal_22446; CGSCC-SAME: (ptr [[A:%.*]]) {2447; CGSCC-NEXT: entry:2448; CGSCC-NEXT: tail call void @use_i32p(ptr [[A]])2449; CGSCC-NEXT: tail call void @use_i32p(ptr [[A]])2450; CGSCC-NEXT: ret void2451;2452entry:2453 tail call void @use_i32p(ptr %a)2454 tail call void @use_i32p(ptr %a)2455 ret void2456}2457declare void @use_i32p(ptr)2458 2459; Allow blockaddress users2460define internal void @dead_with_blockaddress_users(ptr nocapture %pc) nounwind readonly {2461; CGSCC: Function Attrs: nounwind memory(read)2462; CGSCC-LABEL: define {{[^@]+}}@dead_with_blockaddress_users2463; CGSCC-SAME: (ptr captures(none) [[PC:%.*]]) #[[ATTR15:[0-9]+]] {2464; CGSCC-NEXT: entry:2465; CGSCC-NEXT: br label [[INDIRECTGOTO:%.*]]2466; CGSCC: lab0:2467; CGSCC-NEXT: [[INDVAR_NEXT:%.*]] = add i32 [[INDVAR:%.*]], 12468; CGSCC-NEXT: br label [[INDIRECTGOTO]]2469; CGSCC: end:2470; CGSCC-NEXT: ret void2471; CGSCC: indirectgoto:2472; CGSCC-NEXT: [[INDVAR]] = phi i32 [ [[INDVAR_NEXT]], [[LAB0:%.*]] ], [ 0, [[ENTRY:%.*]] ]2473; CGSCC-NEXT: [[PC_ADDR_0:%.*]] = getelementptr i32, ptr [[PC]], i32 [[INDVAR]]2474; CGSCC-NEXT: [[TMP1_PN:%.*]] = load i32, ptr [[PC_ADDR_0]], align 42475; CGSCC-NEXT: [[INDIRECT_GOTO_DEST_IN:%.*]] = getelementptr inbounds [2 x ptr], ptr @dead_with_blockaddress_users.l, i32 0, i32 [[TMP1_PN]]2476; CGSCC-NEXT: [[INDIRECT_GOTO_DEST:%.*]] = load ptr, ptr [[INDIRECT_GOTO_DEST_IN]], align 82477; CGSCC-NEXT: indirectbr ptr [[INDIRECT_GOTO_DEST]], [label [[LAB0]], label %end]2478;2479entry:2480 br label %indirectgoto2481 2482lab0: ; preds = %indirectgoto2483 %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]2484 br label %indirectgoto2485 2486end: ; preds = %indirectgoto2487 ret void2488 2489indirectgoto: ; preds = %lab0, %entry2490 %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2]2491 %pc.addr.0 = getelementptr i32, ptr %pc, i32 %indvar ; <ptr> [#uses=1]2492 %tmp1.pn = load i32, ptr %pc.addr.0 ; <i32> [#uses=1]2493 %indirect.goto.dest.in = getelementptr inbounds [2 x ptr], ptr @dead_with_blockaddress_users.l, i32 0, i32 %tmp1.pn ; <ptr> [#uses=1]2494 %indirect.goto.dest = load ptr, ptr %indirect.goto.dest.in ; <ptr> [#uses=1]2495 indirectbr ptr %indirect.goto.dest, [label %lab0, label %end]2496}2497 2498 2499; The code below exposed a bug that caused %call to be replaced with `undef`.2500 2501%struct.a = type { ptr }2502 2503@e = global ptr null2504 2505define i32 @main() {2506; CHECK-LABEL: define {{[^@]+}}@main() {2507; CHECK-NEXT: entry:2508; CHECK-NEXT: br label [[FOR_COND_0:%.*]]2509; CHECK: for.cond.0:2510; CHECK-NEXT: [[G_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY_0:%.*]] ]2511; CHECK-NEXT: [[CMP_0:%.*]] = icmp ult i32 [[G_0]], 1002512; CHECK-NEXT: br i1 [[CMP_0]], label [[FOR_BODY_0]], label [[FOR_END_0:%.*]]2513; CHECK: for.body.0:2514; CHECK-NEXT: [[INC]] = add nuw nsw i32 [[G_0]], 12515; CHECK-NEXT: br label [[FOR_COND_0]]2516; CHECK: for.end.0:2517; CHECK-NEXT: [[CALL:%.*]] = call ptr @malloc(i64 noundef 8)2518; CHECK-NEXT: store ptr [[CALL]], ptr @e, align 82519; CHECK-NEXT: store ptr null, ptr [[CALL]], align 82520; CHECK-NEXT: br label [[FOR_COND_1:%.*]]2521; CHECK: for.cond.1:2522; CHECK-NEXT: [[G_1:%.*]] = phi i32 [ 0, [[FOR_END_0]] ], [ [[INC6:%.*]], [[FOR_BODY_1:%.*]] ]2523; CHECK-NEXT: [[CMP_1:%.*]] = icmp ult i32 [[G_1]], 1002524; CHECK-NEXT: br i1 [[CMP_1]], label [[FOR_BODY_1]], label [[FOR_END_1:%.*]]2525; CHECK: for.body.1:2526; CHECK-NEXT: [[INC6]] = add nuw nsw i32 [[G_1]], 12527; CHECK-NEXT: br label [[FOR_COND_1]]2528; CHECK: for.end.1:2529; CHECK-NEXT: ret i32 02530;2531entry:2532 %f = alloca i322533 br label %for.cond.02534 2535for.cond.0:2536 %g.0 = phi i32 [ 0, %entry ], [ %inc, %for.body.0 ]2537 %cmp.0 = icmp ult i32 %g.0, 1002538 br i1 %cmp.0, label %for.body.0, label %for.end.02539 2540for.body.0:2541 %inc = add nuw nsw i32 %g.0, 12542 br label %for.cond.02543 2544for.end.0:2545 %call = call ptr @malloc(i64 8)2546 store ptr %call, ptr @e2547 store ptr null, ptr %call2548 br label %for.cond.12549 2550for.cond.1:2551 %g.1 = phi i32 [ 0, %for.end.0 ], [ %inc6, %for.body.1 ]2552 %cmp.1 = icmp ult i32 %g.1, 1002553 br i1 %cmp.1, label %for.body.1, label %for.end.12554 2555for.body.1:2556 %call4 = call i32 (ptr, ...) @h(ptr nonnull %f)2557 %inc6 = add nuw nsw i32 %g.1, 12558 br label %for.cond.12559 2560for.end.1:2561 ret i32 02562}2563 2564declare noalias ptr @malloc(i64)2565 2566define i32 @h(i32 %i) {2567; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2568; TUNIT-LABEL: define {{[^@]+}}@h2569; TUNIT-SAME: (i32 [[I:%.*]]) #[[ATTR13]] {2570; TUNIT-NEXT: ret i32 02571;2572; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2573; CGSCC-LABEL: define {{[^@]+}}@h2574; CGSCC-SAME: (i32 [[I:%.*]]) #[[ATTR6]] {2575; CGSCC-NEXT: ret i32 02576;2577 ret i32 02578}2579 2580 2581; Verify we do not choke on the GEP in the unreachable block.2582 2583@p = global i8 02584 2585define void @bad_gep() {2586; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2587; TUNIT-LABEL: define {{[^@]+}}@bad_gep2588; TUNIT-SAME: () #[[ATTR13]] {2589; TUNIT-NEXT: entry:2590; TUNIT-NEXT: [[N1:%.*]] = alloca i8, i32 0, align 12591; TUNIT-NEXT: [[M2:%.*]] = alloca i8, i32 0, align 12592; TUNIT-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull captures(none) dereferenceable(1) [[N1]]) #[[ATTR18:[0-9]+]]2593; TUNIT-NEXT: br label [[EXIT:%.*]]2594; TUNIT: while.body:2595; TUNIT-NEXT: unreachable2596; TUNIT: if.then:2597; TUNIT-NEXT: unreachable2598; TUNIT: if.end:2599; TUNIT-NEXT: unreachable2600; TUNIT: exit:2601; TUNIT-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull captures(none) dereferenceable(1) [[N1]]) #[[ATTR18]]2602; TUNIT-NEXT: ret void2603;2604; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2605; CGSCC-LABEL: define {{[^@]+}}@bad_gep2606; CGSCC-SAME: () #[[ATTR6]] {2607; CGSCC-NEXT: entry:2608; CGSCC-NEXT: [[N1:%.*]] = alloca i8, i32 0, align 12609; CGSCC-NEXT: [[M2:%.*]] = alloca i8, i32 0, align 12610; CGSCC-NEXT: call void @llvm.lifetime.start.p0(ptr noalias nofree noundef nonnull captures(none) dereferenceable(1) [[N1]]) #[[ATTR21:[0-9]+]]2611; CGSCC-NEXT: br label [[EXIT:%.*]]2612; CGSCC: while.body:2613; CGSCC-NEXT: unreachable2614; CGSCC: if.then:2615; CGSCC-NEXT: unreachable2616; CGSCC: if.end:2617; CGSCC-NEXT: unreachable2618; CGSCC: exit:2619; CGSCC-NEXT: call void @llvm.lifetime.end.p0(ptr noalias nofree noundef nonnull captures(none) dereferenceable(1) [[N1]]) #[[ATTR21]]2620; CGSCC-NEXT: ret void2621;2622entry:2623 %n = alloca i82624 %m = alloca i82625 call void @llvm.lifetime.start.p0(ptr %n)2626 br label %exit2627 2628while.body:2629 %call = call i1 @bad_gep_helper1(ptr %n, ptr %ptr, ptr %m)2630 br i1 %call, label %if.then, label %if.end2631 2632if.then:2633 %0 = load i8, ptr %ptr2634 call void @bad_gep_helper2(i8 %0)2635 br label %if.end2636 2637if.end:2638 %ptr = getelementptr inbounds i8, ptr %ptr, i64 12639 %cmp = icmp eq ptr %ptr, @p2640 br i1 %cmp, label %exit, label %while.body2641 2642exit:2643 call void @llvm.lifetime.end.p0(ptr %n)2644 ret void2645}2646 2647define i8 @edge_vs_block_liveness() {2648; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2649; TUNIT-LABEL: define {{[^@]+}}@edge_vs_block_liveness2650; TUNIT-SAME: () #[[ATTR13]] {2651; TUNIT-NEXT: entry:2652; TUNIT-NEXT: br i1 true, label [[B1:%.*]], label [[B2:%.*]]2653; TUNIT: b1:2654; TUNIT-NEXT: br label [[B2]]2655; TUNIT: b2:2656; TUNIT-NEXT: [[PHI:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ 1, [[B1]] ]2657; TUNIT-NEXT: ret i8 12658;2659; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)2660; CGSCC-LABEL: define {{[^@]+}}@edge_vs_block_liveness2661; CGSCC-SAME: () #[[ATTR6]] {2662; CGSCC-NEXT: entry:2663; CGSCC-NEXT: br i1 true, label [[B1:%.*]], label [[B2:%.*]]2664; CGSCC: b1:2665; CGSCC-NEXT: br label [[B2]]2666; CGSCC: b2:2667; CGSCC-NEXT: [[PHI:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ 1, [[B1]] ]2668; CGSCC-NEXT: ret i8 12669;2670entry:2671 br i1 true, label %b1, label %b22672b1:2673 br label %b22674b2:2675 %phi = phi i8 [0, %entry], [1, %b1]2676 ret i8 %phi2677}2678 2679declare i1 @bad_gep_helper1(ptr, ptr, ptr)2680declare void @bad_gep_helper2(i8)2681 2682declare void @llvm.lifetime.start.p0(ptr %1)2683declare void @llvm.lifetime.end.p0(ptr %1)2684;.2685; TUNIT: attributes #[[ATTR0]] = { nofree noreturn nosync nounwind }2686; TUNIT: attributes #[[ATTR1:[0-9]+]] = { memory(none) }2687; TUNIT: attributes #[[ATTR2]] = { nounwind }2688; TUNIT: attributes #[[ATTR3]] = { noreturn nounwind }2689; TUNIT: attributes #[[ATTR4]] = { noreturn }2690; TUNIT: attributes #[[ATTR5]] = { nosync memory(none) }2691; TUNIT: attributes #[[ATTR6]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) uwtable }2692; TUNIT: attributes #[[ATTR7]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }2693; TUNIT: attributes #[[ATTR8]] = { nofree norecurse noreturn nosync nounwind memory(none) }2694; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree nosync nounwind willreturn memory(none) }2695; TUNIT: attributes #[[ATTR10]] = { nofree nosync nounwind willreturn }2696; TUNIT: attributes #[[ATTR11]] = { mustprogress nofree nosync nounwind willreturn }2697; TUNIT: attributes #[[ATTR12]] = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none) }2698; TUNIT: attributes #[[ATTR13]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }2699; TUNIT: attributes #[[ATTR14:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }2700; TUNIT: attributes #[[ATTR15]] = { nofree noreturn nounwind }2701; TUNIT: attributes #[[ATTR16]] = { nosync }2702; TUNIT: attributes #[[ATTR17]] = { nofree nounwind willreturn }2703; TUNIT: attributes #[[ATTR18]] = { nofree willreturn }2704;.2705; CGSCC: attributes #[[ATTR0]] = { nofree noreturn nosync nounwind }2706; CGSCC: attributes #[[ATTR1:[0-9]+]] = { memory(none) }2707; CGSCC: attributes #[[ATTR2]] = { nounwind }2708; CGSCC: attributes #[[ATTR3]] = { noreturn nounwind }2709; CGSCC: attributes #[[ATTR4]] = { noreturn }2710; CGSCC: attributes #[[ATTR5]] = { nosync memory(none) }2711; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }2712; CGSCC: attributes #[[ATTR7]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) uwtable }2713; CGSCC: attributes #[[ATTR8]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable }2714; CGSCC: attributes #[[ATTR9]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }2715; CGSCC: attributes #[[ATTR10]] = { nofree norecurse noreturn nosync nounwind memory(none) }2716; CGSCC: attributes #[[ATTR11]] = { mustprogress nofree nosync nounwind willreturn memory(none) }2717; CGSCC: attributes #[[ATTR12:[0-9]+]] = { nofree nosync nounwind willreturn }2718; CGSCC: attributes #[[ATTR13]] = { mustprogress nofree nosync nounwind willreturn }2719; CGSCC: attributes #[[ATTR14]] = { mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none) }2720; CGSCC: attributes #[[ATTR15]] = { nounwind memory(read) }2721; CGSCC: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }2722; CGSCC: attributes #[[ATTR17]] = { nofree noreturn nounwind }2723; CGSCC: attributes #[[ATTR18]] = { nosync }2724; CGSCC: attributes #[[ATTR19]] = { nofree nounwind willreturn }2725; CGSCC: attributes #[[ATTR20]] = { nofree nosync willreturn }2726; CGSCC: attributes #[[ATTR21]] = { nofree willreturn }2727;.2728