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
9 ; CHECK: @G1 = constant i32 0
10 ; CHECK: @G2 = constant ptr @G1
12 define internal i32 @test(ptr %x) {
14 ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
15 ; CHECK-LABEL: define {{[^@]+}}@test
16 ; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
18 ; CHECK-NEXT: [[Z:%.*]] = load i32, ptr @G1, align 4
19 ; CHECK-NEXT: ret i32 [[Z]]
27 define i32 @caller() {
28 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
29 ; TUNIT-LABEL: define {{[^@]+}}@caller
30 ; TUNIT-SAME: () #[[ATTR0]] {
32 ; TUNIT-NEXT: [[X:%.*]] = call i32 @test() #[[ATTR1:[0-9]+]]
33 ; TUNIT-NEXT: ret i32 [[X]]
35 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
36 ; CGSCC-LABEL: define {{[^@]+}}@caller
37 ; CGSCC-SAME: () #[[ATTR1:[0-9]+]] {
39 ; CGSCC-NEXT: [[X:%.*]] = call i32 @test() #[[ATTR2:[0-9]+]]
40 ; CGSCC-NEXT: ret i32 [[X]]
43 %x = call i32 @test(ptr @G2)
48 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
49 ; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn memory(read) }
51 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
52 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
53 ; CGSCC: attributes #[[ATTR2]] = { nofree nosync willreturn }