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=2 -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=2 -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 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 norecurse 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:    ret i64 undef
22;
23entry:
24  %ref.tmp = alloca %"a", align 8
25  %call2 = call i64 @f2(%"a"* %ref.tmp)
26  ret i64 %call2
27}
28
29define internal i64 @f2(%"a"* %this) align 2 {
30; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
31; IS__CGSCC____-LABEL: define {{[^@]+}}@f2
32; IS__CGSCC____-SAME: (%a* noalias nocapture nofree noundef nonnull readnone align 8 dereferenceable(8) [[THIS:%.*]]) #[[ATTR0]] align 2 {
33; IS__CGSCC____-NEXT:  entry:
34; IS__CGSCC____-NEXT:    [[THIS_ADDR:%.*]] = alloca %a*, align 8
35; IS__CGSCC____-NEXT:    store %a* [[THIS]], %a** [[THIS_ADDR]], align 8
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 norecurse nosync nounwind readnone willreturn
49; IS__CGSCC____-LABEL: define {{[^@]+}}@f3
50; IS__CGSCC____-SAME: (%b* noalias nocapture nofree readnone [[THIS:%.*]]) #[[ATTR0]] align 2 {
51; IS__CGSCC____-NEXT:  entry:
52; IS__CGSCC____-NEXT:    [[THIS_ADDR:%.*]] = alloca %b*, align 8
53; IS__CGSCC____-NEXT:    store %b* [[THIS]], %b** [[THIS_ADDR]], align 8
54; IS__CGSCC____-NEXT:    ret void
55;
56entry:
57  %this.addr = alloca %"b"*, align 8
58  store %"b"* %this, %"b"** %this.addr, align 8
59  %this1 = load %"b"*, %"b"** %this.addr, align 8
60  %call = call i1 @f4(%"b"* %this1)
61  ret void
62}
63
64define internal i1 @f4(%"b"* %this) align 2 {
65; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
66; IS__CGSCC____-LABEL: define {{[^@]+}}@f4
67; IS__CGSCC____-SAME: (%b* noalias nocapture nofree readnone [[THIS:%.*]]) #[[ATTR0]] align 2 {
68; IS__CGSCC____-NEXT:  entry:
69; IS__CGSCC____-NEXT:    [[THIS_ADDR:%.*]] = alloca %b*, align 8
70; IS__CGSCC____-NEXT:    store %b* [[THIS]], %b** [[THIS_ADDR]], align 8
71; IS__CGSCC____-NEXT:    ret i1 undef
72;
73entry:
74  %this.addr = alloca %"b"*, align 8
75  store %"b"* %this, %"b"** %this.addr, align 8
76  %this1 = load %"b"*, %"b"** %this.addr, align 8
77  %call = call %"a"* @f5(%"b"* %this1)
78  ret i1 undef
79}
80
81define internal %"a"* @f5(%"b"* %this) align 2 {
82; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
83; IS__CGSCC____-LABEL: define {{[^@]+}}@f5
84; IS__CGSCC____-SAME: (%b* noalias nocapture nofree readnone [[THIS:%.*]]) #[[ATTR0]] align 2 {
85; IS__CGSCC____-NEXT:  entry:
86; IS__CGSCC____-NEXT:    [[THIS_ADDR:%.*]] = alloca %b*, align 8
87; IS__CGSCC____-NEXT:    store %b* [[THIS]], %b** [[THIS_ADDR]], align 8
88; IS__CGSCC____-NEXT:    ret %a* undef
89;
90entry:
91  %this.addr = alloca %"b"*, align 8
92  store %"b"* %this, %"b"** %this.addr, align 8
93  %this1 = load %"b"*, %"b"** %this.addr, align 8
94  %0 = bitcast %"b"* %this1 to %"a"*
95  ret %"a"* %0
96}
97;.
98; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind readnone willreturn }
99;.
100; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn }
101;.
102