1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=4 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
6
7%"a" = type { i64 }
8%"b" = type { i8 }
9
10define hidden i64 @f1() align 2 {
11; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
12; IS__TUNIT____-LABEL: define {{[^@]+}}@f1
13; IS__TUNIT____-SAME: () #[[ATTR0:[0-9]+]] align 2 {
14; IS__TUNIT____-NEXT:  entry:
15; IS__TUNIT____-NEXT:    ret i64 undef
16;
17; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
18; IS__CGSCC____-LABEL: define {{[^@]+}}@f1
19; IS__CGSCC____-SAME: () #[[ATTR0:[0-9]+]] align 2 {
20; IS__CGSCC____-NEXT:  entry:
21; IS__CGSCC____-NEXT:    [[REF_TMP:%.*]] = alloca [[A:%.*]], align 8
22; IS__CGSCC____-NEXT:    [[CALL2:%.*]] = call i64 @f2() #[[ATTR2:[0-9]+]]
23; IS__CGSCC____-NEXT:    ret i64 [[CALL2]]
24;
25entry:
26  %ref.tmp = alloca %"a", align 8
27  %call2 = call i64 @f2(%"a"* %ref.tmp)
28  ret i64 %call2
29}
30
31define internal i64 @f2(%"a"* %this) align 2 {
32; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
33; IS__CGSCC____-LABEL: define {{[^@]+}}@f2
34; IS__CGSCC____-SAME: () #[[ATTR0]] align 2 {
35; IS__CGSCC____-NEXT:  entry:
36; IS__CGSCC____-NEXT:    ret i64 undef
37;
38entry:
39  %this.addr = alloca %"a"*, align 8
40  store %"a"* %this, %"a"** %this.addr, align 8
41  %this1 = load %"a"*, %"a"** %this.addr, align 8
42  %0 = bitcast %"a"* %this1 to %"b"*
43  call void @f3(%"b"* %0)
44  ret i64 undef
45}
46
47define internal void @f3(%"b"* %this) align 2 {
48; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
49; IS__CGSCC____-LABEL: define {{[^@]+}}@f3
50; IS__CGSCC____-SAME: () #[[ATTR0]] align 2 {
51; IS__CGSCC____-NEXT:  entry:
52; IS__CGSCC____-NEXT:    ret void
53;
54entry:
55  %this.addr = alloca %"b"*, align 8
56  store %"b"* %this, %"b"** %this.addr, align 8
57  %this1 = load %"b"*, %"b"** %this.addr, align 8
58  %call = call i1 @f4(%"b"* %this1)
59  ret void
60}
61
62define internal i1 @f4(%"b"* %this) align 2 {
63; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn
64; IS__CGSCC____-LABEL: define {{[^@]+}}@f4
65; IS__CGSCC____-SAME: () #[[ATTR0]] align 2 {
66; IS__CGSCC____-NEXT:  entry:
67; IS__CGSCC____-NEXT:    ret i1 undef
68;
69entry:
70  %this.addr = alloca %"b"*, align 8
71  store %"b"* %this, %"b"** %this.addr, align 8
72  %this1 = load %"b"*, %"b"** %this.addr, align 8
73  %call = call %"a"* @f5(%"b"* %this1)
74  ret i1 undef
75}
76
77define internal %"a"* @f5(%"b"* %this) align 2 {
78; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
79; IS__CGSCC____-LABEL: define {{[^@]+}}@f5
80; IS__CGSCC____-SAME: () #[[ATTR1:[0-9]+]] align 2 {
81; IS__CGSCC____-NEXT:  entry:
82; IS__CGSCC____-NEXT:    ret %a* undef
83;
84entry:
85  %this.addr = alloca %"b"*, align 8
86  store %"b"* %this, %"b"** %this.addr, align 8
87  %this1 = load %"b"*, %"b"** %this.addr, align 8
88  %0 = bitcast %"b"* %this1 to %"a"*
89  ret %"a"* %0
90}
91;.
92; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
93;.
94; IS__CGSCC____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
95; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn }
96; IS__CGSCC____: attributes #[[ATTR2]] = { readnone willreturn }
97;.
98