64 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%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 {{[^@]+}}@foo11; TUNIT-SAME: (ptr nofree readnone captures(none) [[PTR:%.*]]) #[[ATTR0:[0-9]+]] {12; TUNIT-NEXT: entry:13; TUNIT-NEXT: [[TMP0:%.*]] = alloca [[STRUCT_TEST_A:%.*]], align 814; TUNIT-NEXT: br label [[CALL_BR:%.*]]15; TUNIT: call.br:16; TUNIT-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_TEST_A]], ptr [[TMP0]], i64 0, i32 217; 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 void19;20; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)21; CGSCC-LABEL: define {{[^@]+}}@foo22; CGSCC-SAME: (ptr nofree writeonly captures(none) [[PTR:%.*]]) #[[ATTR0:[0-9]+]] {23; CGSCC-NEXT: entry:24; CGSCC-NEXT: [[TMP0:%.*]] = alloca [[STRUCT_TEST_A:%.*]], align 825; CGSCC-NEXT: br label [[CALL_BR:%.*]]26; CGSCC: call.br:27; CGSCC-NEXT: [[TMP1:%.*]] = getelementptr inbounds [[STRUCT_TEST_A]], ptr [[TMP0]], i64 0, i32 228; CGSCC-NEXT: store ptr [[PTR]], ptr [[TMP1]], align 829; 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 void31;32entry:33 %0 = alloca %struct.test.a, align 834 br label %call.br35 36call.br:37 %1 = getelementptr inbounds %struct.test.a, ptr %0, i64 0, i32 238 store ptr %ptr, ptr %139 tail call void @bar(ptr noundef byval(%struct.test.a) align 8 %0)40 ret void41}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 {{[^@]+}}@bar46; 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 148; CHECK-NEXT: store i32 1, ptr [[TMP1]], align 449; CHECK-NEXT: ret void50;51 %1 = getelementptr inbounds %struct.test.b, ptr %dev, i64 0, i32 152 store i32 1, ptr %153 ret void54}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