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%S = type { ptr } 6 7; Inlining should nuke the invoke (and any inlined calls) here even with 8; argument promotion running along with it. 9define void @zot() personality ptr @wibble { 10; TUNIT: Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) 11; TUNIT-LABEL: define {{[^@]+}}@zot 12; TUNIT-SAME: () #[[ATTR0:[0-9]+]] personality ptr @wibble { 13; TUNIT-NEXT: bb: 14; TUNIT-NEXT: call void @hoge() #[[ATTR2:[0-9]+]] 15; TUNIT-NEXT: unreachable 16; TUNIT: bb1: 17; TUNIT-NEXT: unreachable 18; TUNIT: bb2: 19; TUNIT-NEXT: unreachable 20; 21; CGSCC: Function Attrs: mustprogress nofree noreturn nosync nounwind willreturn memory(none) 22; CGSCC-LABEL: define {{[^@]+}}@zot 23; CGSCC-SAME: () #[[ATTR0:[0-9]+]] personality ptr @wibble { 24; CGSCC-NEXT: bb: 25; CGSCC-NEXT: call void @hoge() #[[ATTR4:[0-9]+]] 26; CGSCC-NEXT: unreachable 27; CGSCC: bb1: 28; CGSCC-NEXT: unreachable 29; CGSCC: bb2: 30; CGSCC-NEXT: unreachable 31; 32bb: 33 invoke void @hoge() 34 to label %bb1 unwind label %bb2 35 36bb1: 37 unreachable 38 39bb2: 40 %tmp = landingpad { ptr, i32 } 41 cleanup 42 unreachable 43} 44 45define internal void @hoge() { 46; TUNIT: Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) 47; TUNIT-LABEL: define {{[^@]+}}@hoge 48; TUNIT-SAME: () #[[ATTR0]] { 49; TUNIT-NEXT: bb: 50; TUNIT-NEXT: unreachable 51; 52; CGSCC: Function Attrs: mustprogress nofree noreturn nosync nounwind willreturn memory(none) 53; CGSCC-LABEL: define {{[^@]+}}@hoge 54; CGSCC-SAME: () #[[ATTR0]] { 55; CGSCC-NEXT: bb: 56; CGSCC-NEXT: unreachable 57; 58bb: 59 %tmp = call fastcc ptr @spam(ptr @eggs) 60 %tmp1 = call fastcc ptr @spam(ptr @barney) 61 unreachable 62} 63 64define internal fastcc ptr @spam(ptr %arg) { 65; CGSCC: Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) 66; CGSCC-LABEL: define {{[^@]+}}@spam 67; CGSCC-SAME: () #[[ATTR1:[0-9]+]] { 68; CGSCC-NEXT: bb: 69; CGSCC-NEXT: unreachable 70; 71bb: 72 unreachable 73} 74 75define internal i1 @eggs(ptr %arg) { 76; CGSCC-LABEL: define {{[^@]+}}@eggs 77; CGSCC-SAME: (ptr [[ARG:%.*]]) { 78; CGSCC-NEXT: bb: 79; CGSCC-NEXT: [[TMP:%.*]] = call zeroext i1 @barney() 80; CGSCC-NEXT: unreachable 81; 82bb: 83 %tmp = call zeroext i1 @barney(ptr %arg) 84 unreachable 85} 86 87define internal i1 @barney(ptr %arg) { 88; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 89; CGSCC-LABEL: define {{[^@]+}}@barney 90; CGSCC-SAME: () #[[ATTR2:[0-9]+]] { 91; CGSCC-NEXT: bb: 92; CGSCC-NEXT: ret i1 undef 93; 94bb: 95 ret i1 undef 96} 97 98define i32 @test_inf_promote_caller(i32 %arg) { 99; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 100; TUNIT-LABEL: define {{[^@]+}}@test_inf_promote_caller 101; TUNIT-SAME: (i32 [[ARG:%.*]]) #[[ATTR1:[0-9]+]] { 102; TUNIT-NEXT: bb: 103; TUNIT-NEXT: ret i32 0 104; 105; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 106; CGSCC-LABEL: define {{[^@]+}}@test_inf_promote_caller 107; CGSCC-SAME: (i32 [[ARG:%.*]]) #[[ATTR3:[0-9]+]] { 108; CGSCC-NEXT: bb: 109; CGSCC-NEXT: [[TMP:%.*]] = alloca [[S:%.*]], align 8 110; CGSCC-NEXT: [[TMP3:%.*]] = alloca i8, i32 0, align 8 111; CGSCC-NEXT: [[TMP1:%.*]] = alloca [[S]], align 8 112; CGSCC-NEXT: [[TMP14:%.*]] = alloca i8, i32 0, align 8 113; CGSCC-NEXT: ret i32 0 114; 115bb: 116 %tmp = alloca %S 117 %tmp1 = alloca %S 118 %tmp2 = call i32 @test_inf_promote_callee(ptr %tmp, ptr %tmp1) 119 120 ret i32 0 121} 122 123define internal i32 @test_inf_promote_callee(ptr %arg, ptr %arg1) { 124; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 125; CGSCC-LABEL: define {{[^@]+}}@test_inf_promote_callee 126; CGSCC-SAME: () #[[ATTR3]] { 127; CGSCC-NEXT: bb: 128; CGSCC-NEXT: ret i32 undef 129; 130bb: 131 %tmp2 = load ptr, ptr %arg1 132 %tmp4 = load ptr, ptr %arg 133 %tmp5 = call i32 @test_inf_promote_callee(ptr %tmp4, ptr %tmp2) 134 135 ret i32 0 136} 137 138declare i32 @wibble(...) 139;. 140; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) } 141; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } 142; TUNIT: attributes #[[ATTR2]] = { noreturn nounwind memory(none) } 143;. 144; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noreturn nosync nounwind willreturn memory(none) } 145; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) } 146; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } 147; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree nosync nounwind willreturn memory(none) } 148; CGSCC: attributes #[[ATTR4]] = { noreturn nounwind memory(none) } 149;. 150;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: 151; CHECK: {{.*}} 152