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%struct.test.b = type { i32, i32 } 6%struct.test.a = type { %struct.test.b, i32, ptr} 7 8define void @foo(ptr %ptr) { 9; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) 10; TUNIT-LABEL: define {{[^@]+}}@foo 11; TUNIT-SAME: (ptr nofree readnone captures(none) [[PTR:%.*]]) #[[ATTR0:[0-9]+]] { 12; TUNIT-NEXT: entry: 13; TUNIT-NEXT: [[TMP0:%.*]] = alloca [[STRUCT_TEST_A:%.*]], align 8 14; TUNIT-NEXT: br label [[CALL_BR:%.*]] 15; TUNIT: call.br: 16; TUNIT-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_TEST_A]], ptr [[TMP0]], i64 0, i32 2 17; TUNIT-NEXT: tail call void @bar(ptr noalias nofree noundef nonnull readonly byval([[STRUCT_TEST_A]]) align 8 captures(none) dereferenceable(24) [[TMP0]]) #[[ATTR2:[0-9]+]] 18; TUNIT-NEXT: ret void 19; 20; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none) 21; CGSCC-LABEL: define {{[^@]+}}@foo 22; CGSCC-SAME: (ptr nofree writeonly captures(none) [[PTR:%.*]]) #[[ATTR0:[0-9]+]] { 23; CGSCC-NEXT: entry: 24; CGSCC-NEXT: [[TMP0:%.*]] = alloca [[STRUCT_TEST_A:%.*]], align 8 25; CGSCC-NEXT: br label [[CALL_BR:%.*]] 26; CGSCC: call.br: 27; CGSCC-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_TEST_A]], ptr [[TMP0]], i64 0, i32 2 28; CGSCC-NEXT: store ptr [[PTR]], ptr [[TMP1]], align 8 29; CGSCC-NEXT: tail call void @bar(ptr noalias nofree noundef nonnull readnone byval([[STRUCT_TEST_A]]) align 8 captures(none) dereferenceable(24) [[TMP0]]) #[[ATTR2:[0-9]+]] 30; CGSCC-NEXT: ret void 31; 32entry: 33 %0 = alloca %struct.test.a, align 8 34 br label %call.br 35 36call.br: 37 %1 = getelementptr inbounds %struct.test.a, ptr %0, i64 0, i32 2 38 store ptr %ptr, ptr %1 39 tail call void @bar(ptr noundef byval(%struct.test.a) align 8 %0) 40 ret void 41} 42 43define void @bar(ptr noundef byval(%struct.test.a) align 8 %dev) { 44; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 45; CHECK-LABEL: define {{[^@]+}}@bar 46; CHECK-SAME: (ptr noalias nofree noundef nonnull writeonly byval([[STRUCT_TEST_A:%.*]]) align 8 captures(none) dereferenceable(24) [[DEV:%.*]]) #[[ATTR1:[0-9]+]] { 47; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_TEST_B:%.*]], ptr [[DEV]], i64 0, i32 1 48; CHECK-NEXT: store i32 1, ptr [[TMP1]], align 4 49; CHECK-NEXT: ret void 50; 51 %1 = getelementptr inbounds %struct.test.b, ptr %dev, i64 0, i32 1 52 store i32 1, ptr %1 53 ret void 54} 55;. 56; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) } 57; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) } 58; TUNIT: attributes #[[ATTR2]] = { nofree nosync nounwind willreturn memory(write) } 59;. 60; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) } 61; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) } 62; CGSCC: attributes #[[ATTR2]] = { nofree nounwind willreturn memory(write) } 63;. 64