152 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4 5%S = type { ptr }6 7; Inlining should nuke the invoke (and any inlined calls) here even with8; 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 {{[^@]+}}@zot12; TUNIT-SAME: () #[[ATTR0:[0-9]+]] personality ptr @wibble {13; TUNIT-NEXT: bb:14; TUNIT-NEXT: call void @hoge() #[[ATTR2:[0-9]+]]15; TUNIT-NEXT: unreachable16; TUNIT: bb1:17; TUNIT-NEXT: unreachable18; TUNIT: bb2:19; TUNIT-NEXT: unreachable20;21; CGSCC: Function Attrs: mustprogress nofree noreturn nosync nounwind willreturn memory(none)22; CGSCC-LABEL: define {{[^@]+}}@zot23; CGSCC-SAME: () #[[ATTR0:[0-9]+]] personality ptr @wibble {24; CGSCC-NEXT: bb:25; CGSCC-NEXT: call void @hoge() #[[ATTR4:[0-9]+]]26; CGSCC-NEXT: unreachable27; CGSCC: bb1:28; CGSCC-NEXT: unreachable29; CGSCC: bb2:30; CGSCC-NEXT: unreachable31;32bb:33 invoke void @hoge()34 to label %bb1 unwind label %bb235 36bb1:37 unreachable38 39bb2:40 %tmp = landingpad { ptr, i32 }41 cleanup42 unreachable43}44 45define internal void @hoge() {46; TUNIT: Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none)47; TUNIT-LABEL: define {{[^@]+}}@hoge48; TUNIT-SAME: () #[[ATTR0]] {49; TUNIT-NEXT: bb:50; TUNIT-NEXT: unreachable51;52; CGSCC: Function Attrs: mustprogress nofree noreturn nosync nounwind willreturn memory(none)53; CGSCC-LABEL: define {{[^@]+}}@hoge54; CGSCC-SAME: () #[[ATTR0]] {55; CGSCC-NEXT: bb:56; CGSCC-NEXT: unreachable57;58bb:59 %tmp = call fastcc ptr @spam(ptr @eggs)60 %tmp1 = call fastcc ptr @spam(ptr @barney)61 unreachable62}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 {{[^@]+}}@spam67; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {68; CGSCC-NEXT: bb:69; CGSCC-NEXT: unreachable70;71bb:72 unreachable73}74 75define internal i1 @eggs(ptr %arg) {76; CGSCC-LABEL: define {{[^@]+}}@eggs77; CGSCC-SAME: (ptr [[ARG:%.*]]) {78; CGSCC-NEXT: bb:79; CGSCC-NEXT: [[TMP:%.*]] = call zeroext i1 @barney()80; CGSCC-NEXT: unreachable81;82bb:83 %tmp = call zeroext i1 @barney(ptr %arg)84 unreachable85}86 87define internal i1 @barney(ptr %arg) {88; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)89; CGSCC-LABEL: define {{[^@]+}}@barney90; CGSCC-SAME: () #[[ATTR2:[0-9]+]] {91; CGSCC-NEXT: bb:92; CGSCC-NEXT: ret i1 undef93;94bb:95 ret i1 undef96}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_caller101; TUNIT-SAME: (i32 [[ARG:%.*]]) #[[ATTR1:[0-9]+]] {102; TUNIT-NEXT: bb:103; TUNIT-NEXT: ret i32 0104;105; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)106; CGSCC-LABEL: define {{[^@]+}}@test_inf_promote_caller107; CGSCC-SAME: (i32 [[ARG:%.*]]) #[[ATTR3:[0-9]+]] {108; CGSCC-NEXT: bb:109; CGSCC-NEXT: [[TMP:%.*]] = alloca [[S:%.*]], align 8110; CGSCC-NEXT: [[TMP3:%.*]] = alloca i8, i32 0, align 8111; CGSCC-NEXT: [[TMP1:%.*]] = alloca [[S]], align 8112; CGSCC-NEXT: [[TMP14:%.*]] = alloca i8, i32 0, align 8113; CGSCC-NEXT: ret i32 0114;115bb:116 %tmp = alloca %S117 %tmp1 = alloca %S118 %tmp2 = call i32 @test_inf_promote_callee(ptr %tmp, ptr %tmp1)119 120 ret i32 0121}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_callee126; CGSCC-SAME: () #[[ATTR3]] {127; CGSCC-NEXT: bb:128; CGSCC-NEXT: ret i32 undef129;130bb:131 %tmp2 = load ptr, ptr %arg1132 %tmp4 = load ptr, ptr %arg133 %tmp5 = call i32 @test_inf_promote_callee(ptr %tmp4, ptr %tmp2)134 135 ret i32 0136}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