1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals 2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT 3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC 4 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 nosync 10 11declare void @normal_call() readnone 12 13declare i32 @foo() 14 15declare i32 @foo_nounwind() nounwind 16 17declare i32 @foo_noreturn_nounwind() noreturn nounwind 18 19declare i32 @foo_noreturn() noreturn 20 21declare i32 @bar() nosync readnone 22 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 8 29; TUNIT: @a2 = common global i8 0, align 16 30; TUNIT: @e = global ptr null 31; TUNIT: @p = global i8 0 32;. 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 8 35; CGSCC: @a2 = common global i8 0, align 16 36; CGSCC: @e = global ptr null 37; CGSCC: @p = global i8 0 38;. 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_func 42; CGSCC-SAME: () #[[ATTR6:[0-9]+]] { 43; CGSCC-NEXT: br label [[TMP2:%.*]] 44; CGSCC: 1: 45; CGSCC-NEXT: ret i32 undef 46; 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]], 1 51; CGSCC-NEXT: [[TMP7:%.*]] = icmp eq i32 [[TMP3]], 10 52; CGSCC-NEXT: br i1 [[TMP7]], label [[TMP1:%.*]], label [[TMP2]] 53; 54 %2 = icmp slt i32 %0, 1 55 br i1 %2, label %3, label %5 56 57; <label>:3: ; preds = %5, %1 58 %4 = phi i32 [ 1, %1 ], [ %8, %5 ] 59 ret i32 %4 60 61; <label>:5: ; preds = %1, %5 62 %6 = phi i32 [ %9, %5 ], [ 1, %1 ] 63 %7 = phi i32 [ %8, %5 ], [ 1, %1 ] 64 %8 = mul nsw i32 %6, %7 65 %9 = add nuw nsw i32 %6, 1 66 %10 = icmp eq i32 %6, %0 67 br i1 %10, label %3, label %5 68} 69 70define i32 @volatile_load(ptr) norecurse nounwind uwtable { 71; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) uwtable 72; TUNIT-LABEL: define {{[^@]+}}@volatile_load 73; TUNIT-SAME: (ptr nofree noundef align 4 [[TMP0:%.*]]) #[[ATTR6:[0-9]+]] { 74; TUNIT-NEXT: [[TMP2:%.*]] = load volatile i32, ptr [[TMP0]], align 4 75; TUNIT-NEXT: ret i32 [[TMP2]] 76; 77; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) uwtable 78; CGSCC-LABEL: define {{[^@]+}}@volatile_load 79; CGSCC-SAME: (ptr nofree noundef align 4 [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] { 80; CGSCC-NEXT: [[TMP2:%.*]] = load volatile i32, ptr [[TMP0]], align 4 81; CGSCC-NEXT: ret i32 [[TMP2]] 82; 83 %2 = load volatile i32, ptr %0, align 4 84 ret i32 %2 85} 86 87define internal i32 @internal_load(ptr) norecurse nounwind uwtable { 88; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable 89; CGSCC-LABEL: define {{[^@]+}}@internal_load 90; CGSCC-SAME: () #[[ATTR8:[0-9]+]] { 91; CGSCC-NEXT: ret i32 undef 92; 93 %2 = load i32, ptr %0, align 4 94 ret i32 %2 95} 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 nounwind 100; TUNIT-LABEL: define {{[^@]+}}@first_block_no_return 101; 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: unreachable 105; TUNIT: cond.true: 106; TUNIT-NEXT: unreachable 107; TUNIT: cond.false: 108; TUNIT-NEXT: unreachable 109; TUNIT: cond.end: 110; TUNIT-NEXT: unreachable 111; 112; CGSCC: Function Attrs: nofree noreturn nosync nounwind 113; CGSCC-LABEL: define {{[^@]+}}@first_block_no_return 114; 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: unreachable 118; CGSCC: cond.true: 119; CGSCC-NEXT: unreachable 120; CGSCC: cond.false: 121; CGSCC-NEXT: unreachable 122; CGSCC: cond.end: 123; CGSCC-NEXT: unreachable 124; 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, 0 130 br i1 %cmp, label %cond.true, label %cond.false 131 132cond.true: ; preds = %entry 133 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.end 138 139cond.false: ; preds = %entry 140 call void @normal_call() 141 %call1 = call i32 @bar() 142 br label %cond.end 143 144cond.end: ; preds = %cond.false, %cond.true 145 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ] 146 ret i32 %cond 147} 148 149; TEST 2: cond.true is dead, but cond.end is not, since cond.false is live 150 151; This is just an example. For example we can put a sync call in a 152; 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_present 156; TUNIT-SAME: (i32 [[A:%.*]], ptr nofree [[PTR1:%.*]]) { 157; TUNIT-NEXT: entry: 158; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 159; 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: unreachable 163; 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_present 171; CGSCC-SAME: (i32 [[A:%.*]], ptr nofree [[PTR1:%.*]]) { 172; CGSCC-NEXT: entry: 173; CGSCC-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 174; 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: unreachable 178; 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, 0 187 br i1 %cmp, label %cond.true, label %cond.false 188 189cond.true: ; preds = %entry 190 call void @no_return_call() 191 %call = call i32 @volatile_load(ptr %ptr1) 192 br label %cond.end 193 194cond.false: ; preds = %entry 195 call void @normal_call() 196 %call1 = call i32 @bar() 197 br label %cond.end 198 199cond.end: ; preds = %cond.false, %cond.true 200 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ] 201 ret i32 %cond 202} 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: noreturn 208; TUNIT-LABEL: define {{[^@]+}}@all_dead 209; TUNIT-SAME: (i32 [[A:%.*]]) #[[ATTR4:[0-9]+]] { 210; TUNIT-NEXT: entry: 211; TUNIT-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 212; 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: unreachable 216; TUNIT: cond.false: 217; TUNIT-NEXT: call void @no_return_call() #[[ATTR3:[0-9]+]] 218; TUNIT-NEXT: unreachable 219; TUNIT: cond.end: 220; TUNIT-NEXT: unreachable 221; 222; CGSCC: Function Attrs: noreturn 223; CGSCC-LABEL: define {{[^@]+}}@all_dead 224; CGSCC-SAME: (i32 [[A:%.*]]) #[[ATTR4:[0-9]+]] { 225; CGSCC-NEXT: entry: 226; CGSCC-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 227; 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: unreachable 231; CGSCC: cond.false: 232; CGSCC-NEXT: call void @no_return_call() #[[ATTR3:[0-9]+]] 233; CGSCC-NEXT: unreachable 234; CGSCC: cond.end: 235; CGSCC-NEXT: unreachable 236; 237entry: 238 %cmp = icmp eq i32 %a, 0 239 br i1 %cmp, label %cond.true, label %cond.false 240 241cond.true: ; preds = %entry 242 call void @no_return_call() 243 call i32 @dead_internal_func(i32 10) 244 %call = call i32 @foo() 245 br label %cond.end 246 247cond.false: ; preds = %entry 248 call void @no_return_call() 249 call i32 @dead_internal_func(i32 10) 250 %call1 = call i32 @bar() 251 br label %cond.end 252 253cond.end: ; preds = %cond.false, %cond.true 254 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ] 255 ret i32 %cond 256} 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_live 264; CHECK-SAME: (i32 [[A:%.*]]) { 265; CHECK-NEXT: entry: 266; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 267; 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: unreachable 272; 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, 0 281 br i1 %cmp, label %cond.true, label %cond.false 282 283cond.true: ; preds = %entry 284 call void @normal_call() 285 %call = call i32 @foo_noreturn() 286 br label %cond.end 287 288cond.false: ; preds = %entry 289 call void @normal_call() 290 %call1 = call i32 @bar() 291 br label %cond.end 292 293cond.end: ; preds = %cond.false, %cond.true 294 %cond = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ] 295 ret i32 %cond 296} 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_noreturn 302; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 { 303; CHECK-NEXT: entry: 304; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 305; 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: unreachable 318; CHECK: cleanup: 319; CHECK-NEXT: [[RES:%.*]] = landingpad { ptr, i32 } 320; CHECK-NEXT: catch ptr null 321; CHECK-NEXT: ret i32 0 322; 323entry: 324 %cmp = icmp eq i32 %a, 0 325 br i1 %cmp, label %cond.true, label %cond.false 326 327cond.true: ; preds = %entry 328 call void @normal_call() 329 %call = invoke i32 @foo_noreturn() to label %continue 330 unwind label %cleanup 331 332cond.false: ; preds = %entry 333 call void @normal_call() 334 %call1 = call i32 @bar() 335 br label %cond.end 336 337cond.end: ; preds = %cond.false, %continue 338 %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ] 339 ret i32 %cond 340 341continue: 342 br label %cond.end 343 344cleanup: 345 %res = landingpad { ptr, i32 } 346 catch ptr null 347 ret i32 0 348} 349 350; TEST 5.2 noreturn invoke instruction replaced by a call and an unreachable instruction 351; put after it. 352 353define i32 @invoke_noreturn_nounwind(i32 %a) personality ptr @__gxx_personality_v0 { 354; CHECK-LABEL: define {{[^@]+}}@invoke_noreturn_nounwind 355; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 { 356; CHECK-NEXT: entry: 357; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 358; 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: unreachable 363; 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: unreachable 371; CHECK: cleanup: 372; CHECK-NEXT: unreachable 373; 374entry: 375 %cmp = icmp eq i32 %a, 0 376 br i1 %cmp, label %cond.true, label %cond.false 377 378cond.true: ; preds = %entry 379 call void @normal_call() 380 %call = invoke i32 @foo_noreturn_nounwind() to label %continue 381 unwind label %cleanup 382 383 384cond.false: ; preds = %entry 385 call void @normal_call() 386 %call1 = call i32 @bar() 387 br label %cond.end 388 389cond.end: ; preds = %cond.false, %continue 390 %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ] 391 ret i32 %cond 392 393continue: 394 br label %cond.end 395 396cleanup: 397 %res = landingpad { ptr, i32 } 398 catch ptr null 399 ret i32 0 400} 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_nounwind 405; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 { 406; CHECK-NEXT: entry: 407; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 408; 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: unreachable 424; 425entry: 426 %cmp = icmp eq i32 %a, 0 427 br i1 %cmp, label %cond.true, label %cond.false 428 429cond.true: ; preds = %entry 430 call void @normal_call() 431 %call = invoke i32 @foo_nounwind() to label %continue 432 unwind label %cleanup 433 434cond.false: ; preds = %entry 435 call void @normal_call() 436 %call1 = call i32 @bar() 437 br label %cond.end 438 439cond.end: ; preds = %cond.false, %continue 440 %cond = phi i32 [ %call, %continue ], [ %call1, %cond.false ] 441 ret i32 %cond 442 443continue: 444 br label %cond.end 445 446cleanup: 447 %res = landingpad { ptr, i32 } 448 catch ptr null 449 ret i32 0 450} 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_phi 455; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 { 456; CHECK-NEXT: entry: 457; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 458; 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: unreachable 472; 473entry: 474 %cmp = icmp eq i32 %a, 0 475 br i1 %cmp, label %cond.true, label %cond.false 476 477cond.true: ; preds = %entry 478 call void @normal_call() 479 %call = invoke i32 @foo_nounwind() to label %continue 480 unwind label %cleanup 481 482cond.false: ; preds = %entry 483 call void @normal_call() 484 %call1 = call i32 @bar() 485 br label %continue 486 487continue: 488 %p = phi i32 [ 0, %cond.true ], [ 1, %cond.false ] 489 ret i32 %p 490 491cleanup: 492 %res = landingpad { ptr, i32 } catch ptr null 493 ret i32 0 494} 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_dom 499; CHECK-SAME: (i32 [[A:%.*]]) personality ptr @__gxx_personality_v0 { 500; CHECK-NEXT: entry: 501; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[A]], 0 502; 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: unreachable 516; 517entry: 518 %cmp = icmp eq i32 %a, 0 519 br i1 %cmp, label %cond.true, label %cond.false 520 521cond.true: ; preds = %entry 522 call void @normal_call() 523 %call = invoke i32 @foo_nounwind() to label %continue 524 unwind label %cleanup 525 526cond.false: ; preds = %entry 527 call void @normal_call() 528 %call1 = call i32 @bar() 529 br label %continue 530 531continue: 532 %p = phi i32 [ %call, %cond.true ], [ %call1, %cond.false ] 533 ret i32 %p 534 535cleanup: 536 %res = landingpad { ptr, i32 } catch ptr null 537 ret i32 0 538} 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 {{[^@]+}}@ub 546; TUNIT-SAME: (ptr nofree writeonly captures(none) [[TMP0:%.*]]) #[[ATTR7:[0-9]+]] { 547; TUNIT-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1 548; TUNIT-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0 549; TUNIT-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, ptr [[TMP0]], i32 [[STILL_POISON]] 550; TUNIT-NEXT: store i32 0, ptr [[POISON_YET_AGAIN]], align 4 551; TUNIT-NEXT: ret void 552; 553; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 554; CGSCC-LABEL: define {{[^@]+}}@ub 555; CGSCC-SAME: (ptr nofree writeonly captures(none) [[TMP0:%.*]]) #[[ATTR9:[0-9]+]] { 556; CGSCC-NEXT: [[POISON:%.*]] = sub nuw i32 0, 1 557; CGSCC-NEXT: [[STILL_POISON:%.*]] = and i32 [[POISON]], 0 558; CGSCC-NEXT: [[POISON_YET_AGAIN:%.*]] = getelementptr i32, ptr [[TMP0]], i32 [[STILL_POISON]] 559; CGSCC-NEXT: store i32 0, ptr [[POISON_YET_AGAIN]], align 4 560; CGSCC-NEXT: ret void 561; 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_poison 565 store i32 0, ptr %poison_yet_again ; Undefined behavior due to store to poison. 566 ret void 567} 568 569define void @inf_loop() #0 { 570; TUNIT: Function Attrs: nofree norecurse noreturn nosync nounwind memory(none) 571; TUNIT-LABEL: define {{[^@]+}}@inf_loop 572; 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_loop 580; 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.body 588 589while.body: ; preds = %entry, %while.body 590 br label %while.body 591} 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 {{[^@]+}}@test5 599; 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: unreachable 607; TUNIT: cond.else: 608; TUNIT-NEXT: unreachable 609; TUNIT: cond.end: 610; TUNIT-NEXT: ret i32 0 611; 612; CGSCC: Function Attrs: nosync memory(none) 613; CGSCC-LABEL: define {{[^@]+}}@test5 614; 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: unreachable 622; CGSCC: cond.else: 623; CGSCC-NEXT: unreachable 624; CGSCC: cond.end: 625; CGSCC-NEXT: ret i32 0 626; 627 %3 = icmp sgt i32 %0, %1 628 br i1 %3, label %cond.if, label %cond.elseif 629 630cond.if: ; preds = %2 631 %4 = tail call i32 @bar() 632 br label %cond.end 633 634cond.elseif: ; preds = %2 635 call void @inf_loop() 636 %5 = icmp slt i32 %0, %1 637 br i1 %5, label %cond.end, label %cond.else 638 639cond.else: ; preds = %cond.elseif 640 %6 = tail call i32 @foo() 641 br label %cond.end 642 643cond.end: ; preds = %cond.if, %cond.else, %cond.elseif 644 %7 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ] 645 ret i32 %7 646} 647 648define void @rec() #0 { 649; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 650; TUNIT-LABEL: define {{[^@]+}}@rec 651; TUNIT-SAME: () #[[ATTR9:[0-9]+]] { 652; TUNIT-NEXT: entry: 653; TUNIT-NEXT: ret void 654; 655; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 656; CGSCC-LABEL: define {{[^@]+}}@rec 657; CGSCC-SAME: () #[[ATTR11:[0-9]+]] { 658; CGSCC-NEXT: entry: 659; CGSCC-NEXT: ret void 660; 661entry: 662 call void @rec() 663 ret void 664} 665 666; TEST 8: Recursion 667; FIXME: everything after first block should be marked dead 668; and unreachable should be put after call to @rec(). 669 670define i32 @test6(i32, i32) #0 { 671; CHECK-LABEL: define {{[^@]+}}@test6 672; 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, %1 690 br i1 %3, label %cond.if, label %cond.elseif 691 692cond.if: ; preds = %2 693 %4 = tail call i32 @bar() 694 br label %cond.end 695 696cond.elseif: ; preds = %2 697 call void @rec() 698 %5 = icmp slt i32 %0, %1 699 br i1 %5, label %cond.end, label %cond.else 700 701cond.else: ; preds = %cond.elseif 702 %6 = tail call i32 @foo() 703 br label %cond.end 704 705cond.end: ; preds = %cond.if, %cond.else, %cond.elseif 706 %7 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ] 707 ret i32 %7 708} 709; TEST 9: Recursion 710; FIXME: contains recursive call to itself in cond.elseif block 711 712define i32 @test7(i32, i32) #0 { 713; TUNIT-LABEL: define {{[^@]+}}@test7 714; 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 {{[^@]+}}@test7 732; 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, %1 750 br i1 %3, label %cond.if, label %cond.elseif 751 752cond.if: ; preds = %2 753 %4 = tail call i32 @bar() 754 br label %cond.end 755 756cond.elseif: ; preds = %2 757 %5 = tail call i32 @test7(i32 %0, i32 %1) 758 %6 = icmp slt i32 %0, %1 759 br i1 %6, label %cond.end, label %cond.else 760 761cond.else: ; preds = %cond.elseif 762 %7 = tail call i32 @foo() 763 br label %cond.end 764 765cond.end: ; preds = %cond.if, %cond.else, %cond.elseif 766 %8 = phi i32 [ %1, %cond.elseif ], [ 0, %cond.else ], [ 0, %cond.if ] 767 ret i32 %8 768} 769 770; SCC test 771; 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 8 787@a2 = common global i8 0, align 16 788 789define internal ptr @f1(ptr readnone %0) local_unnamed_addr #0 { 790; CGSCC-LABEL: define {{[^@]+}}@f1 791; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr { 792; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null 793; 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, null 802 br i1 %2, label %3, label %5 803 804; <label>:3: ; preds = %1 805 %4 = tail call ptr @f2(ptr nonnull @a1) 806 br label %5 807 808; <label>:5: ; preds = %1, %3 809 %6 = phi ptr [ %4, %3 ], [ %0, %1 ] 810 ret ptr %6 811} 812 813define internal ptr @f2(ptr readnone %0) local_unnamed_addr #0 { 814; CGSCC-LABEL: define {{[^@]+}}@f2 815; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr { 816; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null 817; 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, null 829 br i1 %2, label %5, label %3 830 831; <label>:3: ; preds = %1 832 833 %4 = tail call ptr @f1(ptr nonnull %0) 834 br label %7 835 836; <label>:5: ; preds = %1 837 %6 = tail call ptr @f3(ptr nonnull @a2) 838 br label %7 839 840; <label>:7: ; preds = %5, %3 841 %8 = phi ptr [ %4, %3 ], [ %6, %5 ] 842 ret ptr %8 843} 844 845define internal ptr @f3(ptr readnone %0) local_unnamed_addr #0 { 846; CGSCC-LABEL: define {{[^@]+}}@f3 847; CGSCC-SAME: (ptr readnone [[TMP0:%.*]]) local_unnamed_addr { 848; CGSCC-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null 849; 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, null 858 br i1 %2, label %3, label %5 859 860; <label>:3: ; preds = %1 861 %4 = tail call ptr @f1(ptr nonnull @a2) 862 br label %5 863 864; <label>:5: ; preds = %1, %3 865 %6 = phi ptr [ %4, %3 ], [ @a1, %1 ] 866 ret ptr %6 867} 868 869declare void @sink() nofree nosync nounwind willreturn 870define void @test_unreachable() { 871; TUNIT: Function Attrs: nofree noreturn nosync nounwind 872; TUNIT-LABEL: define {{[^@]+}}@test_unreachable 873; TUNIT-SAME: () #[[ATTR0]] { 874; TUNIT-NEXT: call void @sink() #[[ATTR17:[0-9]+]] 875; TUNIT-NEXT: call void @test_unreachable() #[[ATTR0]] 876; TUNIT-NEXT: unreachable 877; 878; CGSCC: Function Attrs: nofree noreturn nosync nounwind 879; CGSCC-LABEL: define {{[^@]+}}@test_unreachable 880; CGSCC-SAME: () #[[ATTR0]] { 881; CGSCC-NEXT: call void @sink() #[[ATTR19:[0-9]+]] 882; CGSCC-NEXT: call void @test_unreachable() #[[ATTR0]] 883; CGSCC-NEXT: unreachable 884; 885 call void @sink() 886 call void @test_unreachable() 887 unreachable 888} 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 void 910; 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 void 929} 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 void 959; 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 void 988; 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 %bb1 995bb1: 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 %bb2 1001bb2: 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 %bb3 1007bb3: 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 %bb4 1013bb4: 1014 call void @non_exact2() 1015 ret void 1016} 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 void 1037; 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 void 1056} 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 void 1077; 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 void 1097} 1098 1099define internal void @non_dead_a0() { 1100; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1101; TUNIT-LABEL: define {{[^@]+}}@non_dead_a0 1102; TUNIT-SAME: () #[[ATTR11:[0-9]+]] { 1103; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1104; TUNIT-NEXT: ret void 1105; 1106; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1107; CGSCC-LABEL: define {{[^@]+}}@non_dead_a0 1108; CGSCC-SAME: () #[[ATTR13:[0-9]+]] { 1109; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1110; CGSCC-NEXT: ret void 1111; 1112 call void @sink() 1113 ret void 1114} 1115define internal void @non_dead_a1() { 1116; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1117; TUNIT-LABEL: define {{[^@]+}}@non_dead_a1 1118; TUNIT-SAME: () #[[ATTR11]] { 1119; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1120; TUNIT-NEXT: ret void 1121; 1122; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1123; CGSCC-LABEL: define {{[^@]+}}@non_dead_a1 1124; CGSCC-SAME: () #[[ATTR13]] { 1125; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1126; CGSCC-NEXT: ret void 1127; 1128 call void @sink() 1129 ret void 1130} 1131define internal void @non_dead_a2() { 1132; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1133; TUNIT-LABEL: define {{[^@]+}}@non_dead_a2 1134; TUNIT-SAME: () #[[ATTR11]] { 1135; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1136; TUNIT-NEXT: ret void 1137; 1138; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1139; CGSCC-LABEL: define {{[^@]+}}@non_dead_a2 1140; CGSCC-SAME: () #[[ATTR13]] { 1141; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1142; CGSCC-NEXT: ret void 1143; 1144 call void @sink() 1145 ret void 1146} 1147define internal void @non_dead_a3() { 1148; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1149; TUNIT-LABEL: define {{[^@]+}}@non_dead_a3 1150; TUNIT-SAME: () #[[ATTR11]] { 1151; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1152; TUNIT-NEXT: ret void 1153; 1154; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1155; CGSCC-LABEL: define {{[^@]+}}@non_dead_a3 1156; CGSCC-SAME: () #[[ATTR13]] { 1157; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1158; CGSCC-NEXT: ret void 1159; 1160 call void @sink() 1161 ret void 1162} 1163define internal void @non_dead_a4() { 1164; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1165; TUNIT-LABEL: define {{[^@]+}}@non_dead_a4 1166; TUNIT-SAME: () #[[ATTR11]] { 1167; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1168; TUNIT-NEXT: ret void 1169; 1170; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1171; CGSCC-LABEL: define {{[^@]+}}@non_dead_a4 1172; CGSCC-SAME: () #[[ATTR13]] { 1173; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1174; CGSCC-NEXT: ret void 1175; 1176 call void @sink() 1177 ret void 1178} 1179define internal void @non_dead_a5() { 1180; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1181; TUNIT-LABEL: define {{[^@]+}}@non_dead_a5 1182; TUNIT-SAME: () #[[ATTR11]] { 1183; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1184; TUNIT-NEXT: ret void 1185; 1186; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1187; CGSCC-LABEL: define {{[^@]+}}@non_dead_a5 1188; CGSCC-SAME: () #[[ATTR13]] { 1189; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1190; CGSCC-NEXT: ret void 1191; 1192 call void @sink() 1193 ret void 1194} 1195define internal void @non_dead_a6() { 1196; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1197; TUNIT-LABEL: define {{[^@]+}}@non_dead_a6 1198; TUNIT-SAME: () #[[ATTR11]] { 1199; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1200; TUNIT-NEXT: ret void 1201; 1202; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1203; CGSCC-LABEL: define {{[^@]+}}@non_dead_a6 1204; CGSCC-SAME: () #[[ATTR13]] { 1205; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1206; CGSCC-NEXT: ret void 1207; 1208 call void @sink() 1209 ret void 1210} 1211define internal void @non_dead_a7() { 1212; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1213; TUNIT-LABEL: define {{[^@]+}}@non_dead_a7 1214; TUNIT-SAME: () #[[ATTR11]] { 1215; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1216; TUNIT-NEXT: ret void 1217; 1218; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1219; CGSCC-LABEL: define {{[^@]+}}@non_dead_a7 1220; CGSCC-SAME: () #[[ATTR13]] { 1221; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1222; CGSCC-NEXT: ret void 1223; 1224 call void @sink() 1225 ret void 1226} 1227define internal void @non_dead_a8() { 1228; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1229; TUNIT-LABEL: define {{[^@]+}}@non_dead_a8 1230; TUNIT-SAME: () #[[ATTR11]] { 1231; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1232; TUNIT-NEXT: ret void 1233; 1234; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1235; CGSCC-LABEL: define {{[^@]+}}@non_dead_a8 1236; CGSCC-SAME: () #[[ATTR13]] { 1237; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1238; CGSCC-NEXT: ret void 1239; 1240 call void @sink() 1241 ret void 1242} 1243define internal void @non_dead_a9() { 1244; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1245; TUNIT-LABEL: define {{[^@]+}}@non_dead_a9 1246; TUNIT-SAME: () #[[ATTR11]] { 1247; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1248; TUNIT-NEXT: ret void 1249; 1250; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1251; CGSCC-LABEL: define {{[^@]+}}@non_dead_a9 1252; CGSCC-SAME: () #[[ATTR13]] { 1253; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1254; CGSCC-NEXT: ret void 1255; 1256 call void @sink() 1257 ret void 1258} 1259define internal void @non_dead_a10() { 1260; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1261; TUNIT-LABEL: define {{[^@]+}}@non_dead_a10 1262; TUNIT-SAME: () #[[ATTR11]] { 1263; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1264; TUNIT-NEXT: ret void 1265; 1266; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1267; CGSCC-LABEL: define {{[^@]+}}@non_dead_a10 1268; CGSCC-SAME: () #[[ATTR13]] { 1269; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1270; CGSCC-NEXT: ret void 1271; 1272 call void @sink() 1273 ret void 1274} 1275define internal void @non_dead_a11() { 1276; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1277; TUNIT-LABEL: define {{[^@]+}}@non_dead_a11 1278; TUNIT-SAME: () #[[ATTR11]] { 1279; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1280; TUNIT-NEXT: ret void 1281; 1282; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1283; CGSCC-LABEL: define {{[^@]+}}@non_dead_a11 1284; CGSCC-SAME: () #[[ATTR13]] { 1285; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1286; CGSCC-NEXT: ret void 1287; 1288 call void @sink() 1289 ret void 1290} 1291define internal void @non_dead_a12() { 1292; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1293; TUNIT-LABEL: define {{[^@]+}}@non_dead_a12 1294; TUNIT-SAME: () #[[ATTR11]] { 1295; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1296; TUNIT-NEXT: ret void 1297; 1298; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1299; CGSCC-LABEL: define {{[^@]+}}@non_dead_a12 1300; CGSCC-SAME: () #[[ATTR13]] { 1301; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1302; CGSCC-NEXT: ret void 1303; 1304 call void @sink() 1305 ret void 1306} 1307define internal void @non_dead_a13() { 1308; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1309; TUNIT-LABEL: define {{[^@]+}}@non_dead_a13 1310; TUNIT-SAME: () #[[ATTR11]] { 1311; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1312; TUNIT-NEXT: ret void 1313; 1314; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1315; CGSCC-LABEL: define {{[^@]+}}@non_dead_a13 1316; CGSCC-SAME: () #[[ATTR13]] { 1317; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1318; CGSCC-NEXT: ret void 1319; 1320 call void @sink() 1321 ret void 1322} 1323define internal void @non_dead_a14() { 1324; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1325; TUNIT-LABEL: define {{[^@]+}}@non_dead_a14 1326; TUNIT-SAME: () #[[ATTR11]] { 1327; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1328; TUNIT-NEXT: ret void 1329; 1330; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1331; CGSCC-LABEL: define {{[^@]+}}@non_dead_a14 1332; CGSCC-SAME: () #[[ATTR13]] { 1333; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1334; CGSCC-NEXT: ret void 1335; 1336 call void @sink() 1337 ret void 1338} 1339define internal void @non_dead_a15() { 1340; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1341; TUNIT-LABEL: define {{[^@]+}}@non_dead_a15 1342; TUNIT-SAME: () #[[ATTR11]] { 1343; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1344; TUNIT-NEXT: ret void 1345; 1346; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1347; CGSCC-LABEL: define {{[^@]+}}@non_dead_a15 1348; CGSCC-SAME: () #[[ATTR13]] { 1349; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1350; CGSCC-NEXT: ret void 1351; 1352 call void @sink() 1353 ret void 1354} 1355define internal void @non_dead_b0() { 1356; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1357; TUNIT-LABEL: define {{[^@]+}}@non_dead_b0 1358; TUNIT-SAME: () #[[ATTR11]] { 1359; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1360; TUNIT-NEXT: ret void 1361; 1362; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1363; CGSCC-LABEL: define {{[^@]+}}@non_dead_b0 1364; CGSCC-SAME: () #[[ATTR13]] { 1365; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1366; CGSCC-NEXT: ret void 1367; 1368 call void @sink() 1369 ret void 1370} 1371define internal void @non_dead_b1() { 1372; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1373; TUNIT-LABEL: define {{[^@]+}}@non_dead_b1 1374; TUNIT-SAME: () #[[ATTR11]] { 1375; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1376; TUNIT-NEXT: ret void 1377; 1378; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1379; CGSCC-LABEL: define {{[^@]+}}@non_dead_b1 1380; CGSCC-SAME: () #[[ATTR13]] { 1381; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1382; CGSCC-NEXT: ret void 1383; 1384 call void @sink() 1385 ret void 1386} 1387define internal void @non_dead_b2() { 1388; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1389; TUNIT-LABEL: define {{[^@]+}}@non_dead_b2 1390; TUNIT-SAME: () #[[ATTR11]] { 1391; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1392; TUNIT-NEXT: ret void 1393; 1394; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1395; CGSCC-LABEL: define {{[^@]+}}@non_dead_b2 1396; CGSCC-SAME: () #[[ATTR13]] { 1397; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1398; CGSCC-NEXT: ret void 1399; 1400 call void @sink() 1401 ret void 1402} 1403define internal void @non_dead_b3() { 1404; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1405; TUNIT-LABEL: define {{[^@]+}}@non_dead_b3 1406; TUNIT-SAME: () #[[ATTR11]] { 1407; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1408; TUNIT-NEXT: ret void 1409; 1410; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1411; CGSCC-LABEL: define {{[^@]+}}@non_dead_b3 1412; CGSCC-SAME: () #[[ATTR13]] { 1413; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1414; CGSCC-NEXT: ret void 1415; 1416 call void @sink() 1417 ret void 1418} 1419define internal void @non_dead_b4() { 1420; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1421; TUNIT-LABEL: define {{[^@]+}}@non_dead_b4 1422; TUNIT-SAME: () #[[ATTR11]] { 1423; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1424; TUNIT-NEXT: ret void 1425; 1426; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1427; CGSCC-LABEL: define {{[^@]+}}@non_dead_b4 1428; CGSCC-SAME: () #[[ATTR13]] { 1429; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1430; CGSCC-NEXT: ret void 1431; 1432 call void @sink() 1433 ret void 1434} 1435define internal void @non_dead_b5() { 1436; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1437; TUNIT-LABEL: define {{[^@]+}}@non_dead_b5 1438; TUNIT-SAME: () #[[ATTR11]] { 1439; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1440; TUNIT-NEXT: ret void 1441; 1442; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1443; CGSCC-LABEL: define {{[^@]+}}@non_dead_b5 1444; CGSCC-SAME: () #[[ATTR13]] { 1445; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1446; CGSCC-NEXT: ret void 1447; 1448 call void @sink() 1449 ret void 1450} 1451define internal void @non_dead_b6() { 1452; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1453; TUNIT-LABEL: define {{[^@]+}}@non_dead_b6 1454; TUNIT-SAME: () #[[ATTR11]] { 1455; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1456; TUNIT-NEXT: ret void 1457; 1458; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1459; CGSCC-LABEL: define {{[^@]+}}@non_dead_b6 1460; CGSCC-SAME: () #[[ATTR13]] { 1461; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1462; CGSCC-NEXT: ret void 1463; 1464 call void @sink() 1465 ret void 1466} 1467define internal void @non_dead_b7() { 1468; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1469; TUNIT-LABEL: define {{[^@]+}}@non_dead_b7 1470; TUNIT-SAME: () #[[ATTR11]] { 1471; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1472; TUNIT-NEXT: ret void 1473; 1474; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1475; CGSCC-LABEL: define {{[^@]+}}@non_dead_b7 1476; CGSCC-SAME: () #[[ATTR13]] { 1477; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1478; CGSCC-NEXT: ret void 1479; 1480 call void @sink() 1481 ret void 1482} 1483define internal void @non_dead_b8() { 1484; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1485; TUNIT-LABEL: define {{[^@]+}}@non_dead_b8 1486; TUNIT-SAME: () #[[ATTR11]] { 1487; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1488; TUNIT-NEXT: ret void 1489; 1490; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1491; CGSCC-LABEL: define {{[^@]+}}@non_dead_b8 1492; CGSCC-SAME: () #[[ATTR13]] { 1493; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1494; CGSCC-NEXT: ret void 1495; 1496 call void @sink() 1497 ret void 1498} 1499define internal void @non_dead_b9() { 1500; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1501; TUNIT-LABEL: define {{[^@]+}}@non_dead_b9 1502; TUNIT-SAME: () #[[ATTR11]] { 1503; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1504; TUNIT-NEXT: ret void 1505; 1506; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1507; CGSCC-LABEL: define {{[^@]+}}@non_dead_b9 1508; CGSCC-SAME: () #[[ATTR13]] { 1509; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1510; CGSCC-NEXT: ret void 1511; 1512 call void @sink() 1513 ret void 1514} 1515define internal void @non_dead_b10() { 1516; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1517; TUNIT-LABEL: define {{[^@]+}}@non_dead_b10 1518; TUNIT-SAME: () #[[ATTR11]] { 1519; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1520; TUNIT-NEXT: ret void 1521; 1522; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1523; CGSCC-LABEL: define {{[^@]+}}@non_dead_b10 1524; CGSCC-SAME: () #[[ATTR13]] { 1525; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1526; CGSCC-NEXT: ret void 1527; 1528 call void @sink() 1529 ret void 1530} 1531define internal void @non_dead_b11() { 1532; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1533; TUNIT-LABEL: define {{[^@]+}}@non_dead_b11 1534; TUNIT-SAME: () #[[ATTR11]] { 1535; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1536; TUNIT-NEXT: ret void 1537; 1538; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1539; CGSCC-LABEL: define {{[^@]+}}@non_dead_b11 1540; CGSCC-SAME: () #[[ATTR13]] { 1541; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1542; CGSCC-NEXT: ret void 1543; 1544 call void @sink() 1545 ret void 1546} 1547define internal void @non_dead_b12() { 1548; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1549; TUNIT-LABEL: define {{[^@]+}}@non_dead_b12 1550; TUNIT-SAME: () #[[ATTR11]] { 1551; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1552; TUNIT-NEXT: ret void 1553; 1554; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1555; CGSCC-LABEL: define {{[^@]+}}@non_dead_b12 1556; CGSCC-SAME: () #[[ATTR13]] { 1557; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1558; CGSCC-NEXT: ret void 1559; 1560 call void @sink() 1561 ret void 1562} 1563define internal void @non_dead_b13() { 1564; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1565; TUNIT-LABEL: define {{[^@]+}}@non_dead_b13 1566; TUNIT-SAME: () #[[ATTR11]] { 1567; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1568; TUNIT-NEXT: ret void 1569; 1570; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1571; CGSCC-LABEL: define {{[^@]+}}@non_dead_b13 1572; CGSCC-SAME: () #[[ATTR13]] { 1573; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1574; CGSCC-NEXT: ret void 1575; 1576 call void @sink() 1577 ret void 1578} 1579define internal void @non_dead_b14() { 1580; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1581; TUNIT-LABEL: define {{[^@]+}}@non_dead_b14 1582; TUNIT-SAME: () #[[ATTR11]] { 1583; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1584; TUNIT-NEXT: ret void 1585; 1586; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1587; CGSCC-LABEL: define {{[^@]+}}@non_dead_b14 1588; CGSCC-SAME: () #[[ATTR13]] { 1589; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1590; CGSCC-NEXT: ret void 1591; 1592 call void @sink() 1593 ret void 1594} 1595define internal void @non_dead_b15() { 1596; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1597; TUNIT-LABEL: define {{[^@]+}}@non_dead_b15 1598; TUNIT-SAME: () #[[ATTR11]] { 1599; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1600; TUNIT-NEXT: ret void 1601; 1602; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1603; CGSCC-LABEL: define {{[^@]+}}@non_dead_b15 1604; CGSCC-SAME: () #[[ATTR13]] { 1605; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1606; CGSCC-NEXT: ret void 1607; 1608 call void @sink() 1609 ret void 1610} 1611define internal void @non_dead_c0() { 1612; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1613; TUNIT-LABEL: define {{[^@]+}}@non_dead_c0 1614; TUNIT-SAME: () #[[ATTR11]] { 1615; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1616; TUNIT-NEXT: ret void 1617; 1618; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1619; CGSCC-LABEL: define {{[^@]+}}@non_dead_c0 1620; CGSCC-SAME: () #[[ATTR13]] { 1621; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1622; CGSCC-NEXT: ret void 1623; 1624 call void @sink() 1625 ret void 1626} 1627define internal void @non_dead_c1() { 1628; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1629; TUNIT-LABEL: define {{[^@]+}}@non_dead_c1 1630; TUNIT-SAME: () #[[ATTR11]] { 1631; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1632; TUNIT-NEXT: ret void 1633; 1634; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1635; CGSCC-LABEL: define {{[^@]+}}@non_dead_c1 1636; CGSCC-SAME: () #[[ATTR13]] { 1637; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1638; CGSCC-NEXT: ret void 1639; 1640 call void @sink() 1641 ret void 1642} 1643define internal void @non_dead_c2() { 1644; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1645; TUNIT-LABEL: define {{[^@]+}}@non_dead_c2 1646; TUNIT-SAME: () #[[ATTR11]] { 1647; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1648; TUNIT-NEXT: ret void 1649; 1650; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1651; CGSCC-LABEL: define {{[^@]+}}@non_dead_c2 1652; CGSCC-SAME: () #[[ATTR13]] { 1653; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1654; CGSCC-NEXT: ret void 1655; 1656 call void @sink() 1657 ret void 1658} 1659define internal void @non_dead_c3() { 1660; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1661; TUNIT-LABEL: define {{[^@]+}}@non_dead_c3 1662; TUNIT-SAME: () #[[ATTR11]] { 1663; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1664; TUNIT-NEXT: ret void 1665; 1666; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1667; CGSCC-LABEL: define {{[^@]+}}@non_dead_c3 1668; CGSCC-SAME: () #[[ATTR13]] { 1669; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1670; CGSCC-NEXT: ret void 1671; 1672 call void @sink() 1673 ret void 1674} 1675define internal void @non_dead_c4() { 1676; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1677; TUNIT-LABEL: define {{[^@]+}}@non_dead_c4 1678; TUNIT-SAME: () #[[ATTR11]] { 1679; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1680; TUNIT-NEXT: ret void 1681; 1682; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1683; CGSCC-LABEL: define {{[^@]+}}@non_dead_c4 1684; CGSCC-SAME: () #[[ATTR13]] { 1685; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1686; CGSCC-NEXT: ret void 1687; 1688 call void @sink() 1689 ret void 1690} 1691define internal void @non_dead_c5() { 1692; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1693; TUNIT-LABEL: define {{[^@]+}}@non_dead_c5 1694; TUNIT-SAME: () #[[ATTR11]] { 1695; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1696; TUNIT-NEXT: ret void 1697; 1698; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1699; CGSCC-LABEL: define {{[^@]+}}@non_dead_c5 1700; CGSCC-SAME: () #[[ATTR13]] { 1701; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1702; CGSCC-NEXT: ret void 1703; 1704 call void @sink() 1705 ret void 1706} 1707define internal void @non_dead_c6() { 1708; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1709; TUNIT-LABEL: define {{[^@]+}}@non_dead_c6 1710; TUNIT-SAME: () #[[ATTR11]] { 1711; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1712; TUNIT-NEXT: ret void 1713; 1714; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1715; CGSCC-LABEL: define {{[^@]+}}@non_dead_c6 1716; CGSCC-SAME: () #[[ATTR13]] { 1717; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1718; CGSCC-NEXT: ret void 1719; 1720 call void @sink() 1721 ret void 1722} 1723define internal void @non_dead_c7() { 1724; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1725; TUNIT-LABEL: define {{[^@]+}}@non_dead_c7 1726; TUNIT-SAME: () #[[ATTR11]] { 1727; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1728; TUNIT-NEXT: ret void 1729; 1730; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1731; CGSCC-LABEL: define {{[^@]+}}@non_dead_c7 1732; CGSCC-SAME: () #[[ATTR13]] { 1733; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1734; CGSCC-NEXT: ret void 1735; 1736 call void @sink() 1737 ret void 1738} 1739define internal void @non_dead_c8() { 1740; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1741; TUNIT-LABEL: define {{[^@]+}}@non_dead_c8 1742; TUNIT-SAME: () #[[ATTR11]] { 1743; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1744; TUNIT-NEXT: ret void 1745; 1746; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1747; CGSCC-LABEL: define {{[^@]+}}@non_dead_c8 1748; CGSCC-SAME: () #[[ATTR13]] { 1749; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1750; CGSCC-NEXT: ret void 1751; 1752 call void @sink() 1753 ret void 1754} 1755define internal void @non_dead_c9() { 1756; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1757; TUNIT-LABEL: define {{[^@]+}}@non_dead_c9 1758; TUNIT-SAME: () #[[ATTR11]] { 1759; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1760; TUNIT-NEXT: ret void 1761; 1762; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1763; CGSCC-LABEL: define {{[^@]+}}@non_dead_c9 1764; CGSCC-SAME: () #[[ATTR13]] { 1765; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1766; CGSCC-NEXT: ret void 1767; 1768 call void @sink() 1769 ret void 1770} 1771define internal void @non_dead_c10() { 1772; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1773; TUNIT-LABEL: define {{[^@]+}}@non_dead_c10 1774; TUNIT-SAME: () #[[ATTR11]] { 1775; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1776; TUNIT-NEXT: ret void 1777; 1778; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1779; CGSCC-LABEL: define {{[^@]+}}@non_dead_c10 1780; CGSCC-SAME: () #[[ATTR13]] { 1781; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1782; CGSCC-NEXT: ret void 1783; 1784 call void @sink() 1785 ret void 1786} 1787define internal void @non_dead_c11() { 1788; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1789; TUNIT-LABEL: define {{[^@]+}}@non_dead_c11 1790; TUNIT-SAME: () #[[ATTR11]] { 1791; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1792; TUNIT-NEXT: ret void 1793; 1794; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1795; CGSCC-LABEL: define {{[^@]+}}@non_dead_c11 1796; CGSCC-SAME: () #[[ATTR13]] { 1797; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1798; CGSCC-NEXT: ret void 1799; 1800 call void @sink() 1801 ret void 1802} 1803define internal void @non_dead_c12() { 1804; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1805; TUNIT-LABEL: define {{[^@]+}}@non_dead_c12 1806; TUNIT-SAME: () #[[ATTR11]] { 1807; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1808; TUNIT-NEXT: ret void 1809; 1810; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1811; CGSCC-LABEL: define {{[^@]+}}@non_dead_c12 1812; CGSCC-SAME: () #[[ATTR13]] { 1813; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1814; CGSCC-NEXT: ret void 1815; 1816 call void @sink() 1817 ret void 1818} 1819define internal void @non_dead_c13() { 1820; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1821; TUNIT-LABEL: define {{[^@]+}}@non_dead_c13 1822; TUNIT-SAME: () #[[ATTR11]] { 1823; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1824; TUNIT-NEXT: ret void 1825; 1826; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1827; CGSCC-LABEL: define {{[^@]+}}@non_dead_c13 1828; CGSCC-SAME: () #[[ATTR13]] { 1829; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1830; CGSCC-NEXT: ret void 1831; 1832 call void @sink() 1833 ret void 1834} 1835define internal void @non_dead_c14() { 1836; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1837; TUNIT-LABEL: define {{[^@]+}}@non_dead_c14 1838; TUNIT-SAME: () #[[ATTR11]] { 1839; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1840; TUNIT-NEXT: ret void 1841; 1842; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1843; CGSCC-LABEL: define {{[^@]+}}@non_dead_c14 1844; CGSCC-SAME: () #[[ATTR13]] { 1845; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1846; CGSCC-NEXT: ret void 1847; 1848 call void @sink() 1849 ret void 1850} 1851define internal void @non_dead_c15() { 1852; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1853; TUNIT-LABEL: define {{[^@]+}}@non_dead_c15 1854; TUNIT-SAME: () #[[ATTR11]] { 1855; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1856; TUNIT-NEXT: ret void 1857; 1858; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1859; CGSCC-LABEL: define {{[^@]+}}@non_dead_c15 1860; CGSCC-SAME: () #[[ATTR13]] { 1861; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1862; CGSCC-NEXT: ret void 1863; 1864 call void @sink() 1865 ret void 1866} 1867define internal void @non_dead_d0() { 1868; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1869; TUNIT-LABEL: define {{[^@]+}}@non_dead_d0 1870; TUNIT-SAME: () #[[ATTR11]] { 1871; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1872; TUNIT-NEXT: ret void 1873; 1874; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1875; CGSCC-LABEL: define {{[^@]+}}@non_dead_d0 1876; CGSCC-SAME: () #[[ATTR13]] { 1877; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1878; CGSCC-NEXT: ret void 1879; 1880 call void @sink() 1881 ret void 1882} 1883define internal void @non_dead_d1() { 1884; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1885; TUNIT-LABEL: define {{[^@]+}}@non_dead_d1 1886; TUNIT-SAME: () #[[ATTR11]] { 1887; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1888; TUNIT-NEXT: ret void 1889; 1890; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1891; CGSCC-LABEL: define {{[^@]+}}@non_dead_d1 1892; CGSCC-SAME: () #[[ATTR13]] { 1893; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1894; CGSCC-NEXT: ret void 1895; 1896 call void @sink() 1897 ret void 1898} 1899define internal void @non_dead_d2() { 1900; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1901; TUNIT-LABEL: define {{[^@]+}}@non_dead_d2 1902; TUNIT-SAME: () #[[ATTR11]] { 1903; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1904; TUNIT-NEXT: ret void 1905; 1906; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1907; CGSCC-LABEL: define {{[^@]+}}@non_dead_d2 1908; CGSCC-SAME: () #[[ATTR13]] { 1909; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1910; CGSCC-NEXT: ret void 1911; 1912 call void @sink() 1913 ret void 1914} 1915define internal void @non_dead_d3() { 1916; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1917; TUNIT-LABEL: define {{[^@]+}}@non_dead_d3 1918; TUNIT-SAME: () #[[ATTR11]] { 1919; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1920; TUNIT-NEXT: ret void 1921; 1922; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1923; CGSCC-LABEL: define {{[^@]+}}@non_dead_d3 1924; CGSCC-SAME: () #[[ATTR13]] { 1925; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1926; CGSCC-NEXT: ret void 1927; 1928 call void @sink() 1929 ret void 1930} 1931define internal void @non_dead_d4() { 1932; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1933; TUNIT-LABEL: define {{[^@]+}}@non_dead_d4 1934; TUNIT-SAME: () #[[ATTR11]] { 1935; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1936; TUNIT-NEXT: ret void 1937; 1938; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1939; CGSCC-LABEL: define {{[^@]+}}@non_dead_d4 1940; CGSCC-SAME: () #[[ATTR13]] { 1941; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1942; CGSCC-NEXT: ret void 1943; 1944 call void @sink() 1945 ret void 1946} 1947define internal void @non_dead_d5() { 1948; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1949; TUNIT-LABEL: define {{[^@]+}}@non_dead_d5 1950; TUNIT-SAME: () #[[ATTR11]] { 1951; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1952; TUNIT-NEXT: ret void 1953; 1954; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1955; CGSCC-LABEL: define {{[^@]+}}@non_dead_d5 1956; CGSCC-SAME: () #[[ATTR13]] { 1957; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1958; CGSCC-NEXT: ret void 1959; 1960 call void @sink() 1961 ret void 1962} 1963define internal void @non_dead_d6() { 1964; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1965; TUNIT-LABEL: define {{[^@]+}}@non_dead_d6 1966; TUNIT-SAME: () #[[ATTR11]] { 1967; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1968; TUNIT-NEXT: ret void 1969; 1970; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1971; CGSCC-LABEL: define {{[^@]+}}@non_dead_d6 1972; CGSCC-SAME: () #[[ATTR13]] { 1973; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1974; CGSCC-NEXT: ret void 1975; 1976 call void @sink() 1977 ret void 1978} 1979define internal void @non_dead_d7() { 1980; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1981; TUNIT-LABEL: define {{[^@]+}}@non_dead_d7 1982; TUNIT-SAME: () #[[ATTR11]] { 1983; TUNIT-NEXT: call void @sink() #[[ATTR17]] 1984; TUNIT-NEXT: ret void 1985; 1986; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 1987; CGSCC-LABEL: define {{[^@]+}}@non_dead_d7 1988; CGSCC-SAME: () #[[ATTR13]] { 1989; CGSCC-NEXT: call void @sink() #[[ATTR19]] 1990; CGSCC-NEXT: ret void 1991; 1992 call void @sink() 1993 ret void 1994} 1995define internal void @non_dead_d8() { 1996; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 1997; TUNIT-LABEL: define {{[^@]+}}@non_dead_d8 1998; TUNIT-SAME: () #[[ATTR11]] { 1999; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2000; TUNIT-NEXT: ret void 2001; 2002; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2003; CGSCC-LABEL: define {{[^@]+}}@non_dead_d8 2004; CGSCC-SAME: () #[[ATTR13]] { 2005; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2006; CGSCC-NEXT: ret void 2007; 2008 call void @sink() 2009 ret void 2010} 2011define internal void @non_dead_d9() { 2012; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2013; TUNIT-LABEL: define {{[^@]+}}@non_dead_d9 2014; TUNIT-SAME: () #[[ATTR11]] { 2015; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2016; TUNIT-NEXT: ret void 2017; 2018; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2019; CGSCC-LABEL: define {{[^@]+}}@non_dead_d9 2020; CGSCC-SAME: () #[[ATTR13]] { 2021; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2022; CGSCC-NEXT: ret void 2023; 2024 call void @sink() 2025 ret void 2026} 2027define internal void @non_dead_d10() { 2028; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2029; TUNIT-LABEL: define {{[^@]+}}@non_dead_d10 2030; TUNIT-SAME: () #[[ATTR11]] { 2031; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2032; TUNIT-NEXT: ret void 2033; 2034; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2035; CGSCC-LABEL: define {{[^@]+}}@non_dead_d10 2036; CGSCC-SAME: () #[[ATTR13]] { 2037; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2038; CGSCC-NEXT: ret void 2039; 2040 call void @sink() 2041 ret void 2042} 2043define internal void @non_dead_d11() { 2044; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2045; TUNIT-LABEL: define {{[^@]+}}@non_dead_d11 2046; TUNIT-SAME: () #[[ATTR11]] { 2047; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2048; TUNIT-NEXT: ret void 2049; 2050; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2051; CGSCC-LABEL: define {{[^@]+}}@non_dead_d11 2052; CGSCC-SAME: () #[[ATTR13]] { 2053; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2054; CGSCC-NEXT: ret void 2055; 2056 call void @sink() 2057 ret void 2058} 2059define internal void @non_dead_d12() { 2060; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2061; TUNIT-LABEL: define {{[^@]+}}@non_dead_d12 2062; TUNIT-SAME: () #[[ATTR11]] { 2063; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2064; TUNIT-NEXT: ret void 2065; 2066; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2067; CGSCC-LABEL: define {{[^@]+}}@non_dead_d12 2068; CGSCC-SAME: () #[[ATTR13]] { 2069; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2070; CGSCC-NEXT: ret void 2071; 2072 call void @sink() 2073 ret void 2074} 2075define internal void @non_dead_d13() { 2076; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2077; TUNIT-LABEL: define {{[^@]+}}@non_dead_d13 2078; TUNIT-SAME: () #[[ATTR11]] { 2079; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2080; TUNIT-NEXT: ret void 2081; 2082; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2083; CGSCC-LABEL: define {{[^@]+}}@non_dead_d13 2084; CGSCC-SAME: () #[[ATTR13]] { 2085; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2086; CGSCC-NEXT: ret void 2087; 2088 call void @sink() 2089 ret void 2090} 2091define internal void @non_dead_d14() { 2092; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2093; TUNIT-LABEL: define {{[^@]+}}@non_dead_d14 2094; TUNIT-SAME: () #[[ATTR11]] { 2095; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2096; TUNIT-NEXT: ret void 2097; 2098; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2099; CGSCC-LABEL: define {{[^@]+}}@non_dead_d14 2100; CGSCC-SAME: () #[[ATTR13]] { 2101; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2102; CGSCC-NEXT: ret void 2103; 2104 call void @sink() 2105 ret void 2106} 2107define internal void @non_dead_d15() { 2108; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2109; TUNIT-LABEL: define {{[^@]+}}@non_dead_d15 2110; TUNIT-SAME: () #[[ATTR11]] { 2111; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2112; TUNIT-NEXT: ret void 2113; 2114; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2115; CGSCC-LABEL: define {{[^@]+}}@non_dead_d15 2116; CGSCC-SAME: () #[[ATTR13]] { 2117; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2118; CGSCC-NEXT: ret void 2119; 2120 call void @sink() 2121 ret void 2122} 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 void 2127; 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() noreturn 2134define void @live_with_dead_entry() personality ptr @__gxx_personality_v0 { 2135entry: 2136 invoke void @blowup() to label %live_with_dead_entry unwind label %lpad 2137lpad: 2138 %0 = landingpad { ptr, i32 } catch ptr null 2139 br label %live_with_dead_entry 2140live_with_dead_entry: 2141 ret void 2142} 2143 2144define void @live_with_dead_entry_lp() personality ptr @__gxx_personality_v0 { 2145; CHECK: Function Attrs: nounwind 2146; CHECK-LABEL: define {{[^@]+}}@live_with_dead_entry_lp 2147; 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 null 2154; 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 null 2159; CHECK-NEXT: br label [[LIVE_WITH_DEAD_ENTRY:%.*]] 2160; CHECK: live_with_dead_entry.dead: 2161; CHECK-NEXT: unreachable 2162; CHECK: live_with_dead_entry.dead1: 2163; CHECK-NEXT: unreachable 2164; CHECK: live_with_dead_entry: 2165; CHECK-NEXT: ret void 2166; 2167entry: 2168 invoke void @blowup() to label %live_with_dead_entry unwind label %lp1 2169lp1: 2170 %lp = landingpad { ptr, i32 } catch ptr null 2171 invoke void @blowup() to label %live_with_dead_entry unwind label %lp2 2172lp2: 2173 %0 = landingpad { ptr, i32 } catch ptr null 2174 br label %live_with_dead_entry 2175live_with_dead_entry: 2176 ret void 2177} 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_sink 2182; TUNIT-SAME: () #[[ATTR12:[0-9]+]] { 2183; TUNIT-NEXT: call void @sink() #[[ATTR17]] 2184; TUNIT-NEXT: ret void 2185; 2186; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none) 2187; CGSCC-LABEL: define {{[^@]+}}@useless_arg_sink 2188; CGSCC-SAME: () #[[ATTR14:[0-9]+]] { 2189; CGSCC-NEXT: call void @sink() #[[ATTR19]] 2190; CGSCC-NEXT: ret void 2191; 2192 call void @sink() 2193 ret void 2194} 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_sink 2199; TUNIT-SAME: () #[[ATTR12]] { 2200; TUNIT-NEXT: call void @useless_arg_sink() #[[ATTR10]] 2201; TUNIT-NEXT: ret void 2202; 2203; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none) 2204; CGSCC-LABEL: define {{[^@]+}}@useless_arg_almost_sink 2205; CGSCC-SAME: () #[[ATTR14]] { 2206; CGSCC-NEXT: call void @useless_arg_sink() #[[ATTR19]] 2207; CGSCC-NEXT: ret void 2208; 2209 call void @useless_arg_sink(ptr %a) 2210 ret void 2211} 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_ext 2216; CHECK-SAME: (ptr [[A:%.*]]) { 2217; CHECK-NEXT: call void @useless_arg_almost_sink() #[[ATTR2]] 2218; CHECK-NEXT: ret void 2219; 2220 call void @useless_arg_almost_sink(ptr %a) 2221 ret void 2222} 2223 2224define internal void @useless_arg_ext_int(ptr %a) { 2225; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext_int 2226; CHECK-SAME: (ptr [[A:%.*]]) { 2227; CHECK-NEXT: call void @useless_arg_ext(ptr [[A]]) 2228; CHECK-NEXT: ret void 2229; 2230 call void @useless_arg_ext(ptr %a) 2231 ret void 2232} 2233 2234define void @useless_arg_ext_int_ext(ptr %a) { 2235; CHECK-LABEL: define {{[^@]+}}@useless_arg_ext_int_ext 2236; CHECK-SAME: (ptr [[A:%.*]]) { 2237; CHECK-NEXT: call void @useless_arg_ext_int(ptr [[A]]) 2238; CHECK-NEXT: ret void 2239; 2240 call void @useless_arg_ext_int(ptr %a) 2241 ret void 2242} 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_default 2249; 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 undef 2258; TUNIT: return: 2259; TUNIT-NEXT: unreachable 2260; 2261; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(readwrite, argmem: none) 2262; CGSCC-LABEL: define {{[^@]+}}@switch_default 2263; 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 123 2272; CGSCC: return: 2273; CGSCC-NEXT: unreachable 2274; 2275entry: 2276 switch i64 %i, label %sw.default [ 2277 i64 3, label %return 2278 i64 10, label %return 2279 ] 2280 2281sw.default: 2282 call void @sink() 2283 ret i32 123 2284 2285return: 2286 ret i32 0 2287} 2288 2289define i32 @switch_default_caller() { 2290; TUNIT: Function Attrs: mustprogress nofree nosync nounwind willreturn 2291; TUNIT-LABEL: define {{[^@]+}}@switch_default_caller 2292; TUNIT-SAME: () #[[ATTR11]] { 2293; TUNIT-NEXT: [[CALL2:%.*]] = tail call i32 @switch_default() #[[ATTR10]] 2294; TUNIT-NEXT: ret i32 123 2295; 2296; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn 2297; CGSCC-LABEL: define {{[^@]+}}@switch_default_caller 2298; 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 %call2 2304} 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_dead 2309; 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 123 2317; CGSCC: return: 2318; CGSCC-NEXT: unreachable 2319; 2320entry: 2321 switch i64 %i, label %sw.default [ 2322 i64 3, label %return 2323 i64 10, label %return 2324 ] 2325 2326sw.default: 2327 ret i32 123 2328 2329return: 2330 ret i32 0 2331} 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_caller 2336; TUNIT-SAME: () #[[ATTR13:[0-9]+]] { 2337; TUNIT-NEXT: ret i32 123 2338; 2339; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 2340; CGSCC-LABEL: define {{[^@]+}}@switch_default_dead_caller 2341; 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 %call2 2347} 2348 2349define void @call_via_pointer_with_dead_args(ptr %a, ptr %b, ptr %fp) { 2350; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args 2351; 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 void 2354; 2355 call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null) 2356 ret void 2357} 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_a 2361; 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 void 2364; 2365; CGSCC-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_a 2366; 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 void 2369; 2370 call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null) 2371 ret void 2372} 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_b 2375; 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 void 2378; 2379; CGSCC-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_internal_b 2380; 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 void 2383; 2384 call void %fp(ptr %a, ptr %b, ptr %a, i64 -1, ptr null) 2385 ret void 2386} 2387define void @call_via_pointer_with_dead_args_caller(ptr %a, ptr %b) { 2388; CHECK-LABEL: define {{[^@]+}}@call_via_pointer_with_dead_args_caller 2389; CHECK-SAME: (ptr [[A:%.*]], ptr [[B:%.*]]) { 2390; CHECK-NEXT: [[PTR1:%.*]] = alloca i32, align 128 2391; CHECK-NEXT: [[PTR2:%.*]] = alloca i32, align 128 2392; CHECK-NEXT: [[PTR3:%.*]] = alloca i32, align 128 2393; CHECK-NEXT: [[PTR4:%.*]] = alloca i32, align 128 2394; 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 void 2399; 2400 %ptr1 = alloca i32, align 128 2401 %ptr2 = alloca i32, align 128 2402 %ptr3 = alloca i32, align 128 2403 %ptr4 = alloca i32, align 128 2404 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 void 2409} 2410define void @called_via_pointer(ptr %a, ptr %b, ptr %c, i64 %d, ptr %e) { 2411; CHECK-LABEL: define {{[^@]+}}@called_via_pointer 2412; 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 void 2417; 2418entry: 2419 tail call void @use_i32p(ptr %a) 2420 tail call void @use_i32p(ptr %a) 2421 ret void 2422} 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_1 2425; 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 void 2430; 2431entry: 2432 tail call void @use_i32p(ptr %a) 2433 tail call void @use_i32p(ptr %a) 2434 ret void 2435} 2436; FIXME: Figure out why the MODULE has the unused arguments still 2437define 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_2 2439; 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 void 2444; 2445; CGSCC-LABEL: define {{[^@]+}}@called_via_pointer_internal_2 2446; 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 void 2451; 2452entry: 2453 tail call void @use_i32p(ptr %a) 2454 tail call void @use_i32p(ptr %a) 2455 ret void 2456} 2457declare void @use_i32p(ptr) 2458 2459; Allow blockaddress users 2460define 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_users 2463; 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:%.*]], 1 2468; CGSCC-NEXT: br label [[INDIRECTGOTO]] 2469; CGSCC: end: 2470; CGSCC-NEXT: ret void 2471; 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 4 2475; 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 8 2477; CGSCC-NEXT: indirectbr ptr [[INDIRECT_GOTO_DEST]], [label [[LAB0]], label %end] 2478; 2479entry: 2480 br label %indirectgoto 2481 2482lab0: ; preds = %indirectgoto 2483 %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] 2484 br label %indirectgoto 2485 2486end: ; preds = %indirectgoto 2487 ret void 2488 2489indirectgoto: ; preds = %lab0, %entry 2490 %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 null 2504 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]], 100 2512; 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]], 1 2515; 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 8 2519; CHECK-NEXT: store ptr null, ptr [[CALL]], align 8 2520; 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]], 100 2524; 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]], 1 2527; CHECK-NEXT: br label [[FOR_COND_1]] 2528; CHECK: for.end.1: 2529; CHECK-NEXT: ret i32 0 2530; 2531entry: 2532 %f = alloca i32 2533 br label %for.cond.0 2534 2535for.cond.0: 2536 %g.0 = phi i32 [ 0, %entry ], [ %inc, %for.body.0 ] 2537 %cmp.0 = icmp ult i32 %g.0, 100 2538 br i1 %cmp.0, label %for.body.0, label %for.end.0 2539 2540for.body.0: 2541 %inc = add nuw nsw i32 %g.0, 1 2542 br label %for.cond.0 2543 2544for.end.0: 2545 %call = call ptr @malloc(i64 8) 2546 store ptr %call, ptr @e 2547 store ptr null, ptr %call 2548 br label %for.cond.1 2549 2550for.cond.1: 2551 %g.1 = phi i32 [ 0, %for.end.0 ], [ %inc6, %for.body.1 ] 2552 %cmp.1 = icmp ult i32 %g.1, 100 2553 br i1 %cmp.1, label %for.body.1, label %for.end.1 2554 2555for.body.1: 2556 %call4 = call i32 (ptr, ...) @h(ptr nonnull %f) 2557 %inc6 = add nuw nsw i32 %g.1, 1 2558 br label %for.cond.1 2559 2560for.end.1: 2561 ret i32 0 2562} 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 {{[^@]+}}@h 2569; TUNIT-SAME: (i32 [[I:%.*]]) #[[ATTR13]] { 2570; TUNIT-NEXT: ret i32 0 2571; 2572; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 2573; CGSCC-LABEL: define {{[^@]+}}@h 2574; CGSCC-SAME: (i32 [[I:%.*]]) #[[ATTR6]] { 2575; CGSCC-NEXT: ret i32 0 2576; 2577 ret i32 0 2578} 2579 2580 2581; Verify we do not choke on the GEP in the unreachable block. 2582 2583@p = global i8 0 2584 2585define void @bad_gep() { 2586; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 2587; TUNIT-LABEL: define {{[^@]+}}@bad_gep 2588; TUNIT-SAME: () #[[ATTR13]] { 2589; TUNIT-NEXT: entry: 2590; TUNIT-NEXT: [[N1:%.*]] = alloca i8, i32 0, align 1 2591; TUNIT-NEXT: [[M2:%.*]] = alloca i8, i32 0, align 1 2592; TUNIT-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 1, 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: unreachable 2596; TUNIT: if.then: 2597; TUNIT-NEXT: unreachable 2598; TUNIT: if.end: 2599; TUNIT-NEXT: unreachable 2600; TUNIT: exit: 2601; TUNIT-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 1, ptr noalias nofree noundef nonnull captures(none) dereferenceable(1) [[N1]]) #[[ATTR18]] 2602; TUNIT-NEXT: ret void 2603; 2604; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 2605; CGSCC-LABEL: define {{[^@]+}}@bad_gep 2606; CGSCC-SAME: () #[[ATTR6]] { 2607; CGSCC-NEXT: entry: 2608; CGSCC-NEXT: [[N1:%.*]] = alloca i8, i32 0, align 1 2609; CGSCC-NEXT: [[M2:%.*]] = alloca i8, i32 0, align 1 2610; CGSCC-NEXT: call void @llvm.lifetime.start.p0(i64 noundef 1, 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: unreachable 2614; CGSCC: if.then: 2615; CGSCC-NEXT: unreachable 2616; CGSCC: if.end: 2617; CGSCC-NEXT: unreachable 2618; CGSCC: exit: 2619; CGSCC-NEXT: call void @llvm.lifetime.end.p0(i64 noundef 1, ptr noalias nofree noundef nonnull captures(none) dereferenceable(1) [[N1]]) #[[ATTR21]] 2620; CGSCC-NEXT: ret void 2621; 2622entry: 2623 %n = alloca i8 2624 %m = alloca i8 2625 call void @llvm.lifetime.start.p0(i64 1, ptr %n) 2626 br label %exit 2627 2628while.body: 2629 %call = call i1 @bad_gep_helper1(ptr %n, ptr %ptr, ptr %m) 2630 br i1 %call, label %if.then, label %if.end 2631 2632if.then: 2633 %0 = load i8, ptr %ptr 2634 call void @bad_gep_helper2(i8 %0) 2635 br label %if.end 2636 2637if.end: 2638 %ptr = getelementptr inbounds i8, ptr %ptr, i64 1 2639 %cmp = icmp eq ptr %ptr, @p 2640 br i1 %cmp, label %exit, label %while.body 2641 2642exit: 2643 call void @llvm.lifetime.end.p0(i64 1, ptr %n) 2644 ret void 2645} 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_liveness 2650; 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 1 2658; 2659; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 2660; CGSCC-LABEL: define {{[^@]+}}@edge_vs_block_liveness 2661; 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 1 2669; 2670entry: 2671 br i1 true, label %b1, label %b2 2672b1: 2673 br label %b2 2674b2: 2675 %phi = phi i8 [0, %entry], [1, %b1] 2676 ret i8 %phi 2677} 2678 2679declare i1 @bad_gep_helper1(ptr, ptr, ptr) 2680declare void @bad_gep_helper2(i8) 2681 2682declare void @llvm.lifetime.start.p0(i64 %0, ptr %1) 2683declare void @llvm.lifetime.end.p0(i64 %0, 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