• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes
2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=1 -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=1 -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;
8;                            /---------------------------------------|
9;                            |                /----------------------|----|
10;                            |                |                /-----|    |
11;                            V                V                V     |    |
12;    void broker(int (*cb0)(int), int (*cb1)(int), int (*cb2)(int), int, int);
13;
14;    static int cb0(int zero) {
15;      return zero;
16;    }
17;    static int cb1(int unknown) {
18;      return unknown;
19;    }
20;    static int cb2(int unknown) {
21;      cb0(0);
22;      return unknown;
23;    }
24;    static int cb3(int unknown) {
25;      return unknown;
26;    }
27;    static int cb4(int unknown) {
28;      return unknown;
29;    }
30;
31;    void foo() {
32;      cb0(0);
33;      cb3(1);
34;      broker(cb0, cb1, cb0, 0, 1);
35;      broker(cb1, cb2, cb2, 0, 1);
36;      broker(cb3, cb2, cb3, 0, 1);
37;      broker(cb4, cb4, cb4, 0, 1);
38;    }
39;
40target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
41
42define internal i32 @cb0(i32 %zero) {
43; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
44; IS__TUNIT____-LABEL: define {{[^@]+}}@cb0
45; IS__TUNIT____-SAME: (i32 returned [[ZERO:%.*]]) [[ATTR0:#.*]] {
46; IS__TUNIT____-NEXT:  entry:
47; IS__TUNIT____-NEXT:    ret i32 0
48;
49; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
50; IS__CGSCC____-LABEL: define {{[^@]+}}@cb0
51; IS__CGSCC____-SAME: (i32 returned [[ZERO:%.*]]) [[ATTR0:#.*]] {
52; IS__CGSCC____-NEXT:  entry:
53; IS__CGSCC____-NEXT:    ret i32 0
54;
55entry:
56  ret i32 %zero
57}
58
59define internal i32 @cb1(i32 %unknown) {
60; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
61; IS__TUNIT____-LABEL: define {{[^@]+}}@cb1
62; IS__TUNIT____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
63; IS__TUNIT____-NEXT:  entry:
64; IS__TUNIT____-NEXT:    ret i32 [[UNKNOWN]]
65;
66; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
67; IS__CGSCC____-LABEL: define {{[^@]+}}@cb1
68; IS__CGSCC____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
69; IS__CGSCC____-NEXT:  entry:
70; IS__CGSCC____-NEXT:    ret i32 [[UNKNOWN]]
71;
72entry:
73  ret i32 %unknown
74}
75
76define internal i32 @cb2(i32 %unknown) {
77; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
78; IS__TUNIT____-LABEL: define {{[^@]+}}@cb2
79; IS__TUNIT____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
80; IS__TUNIT____-NEXT:  entry:
81; IS__TUNIT____-NEXT:    ret i32 [[UNKNOWN]]
82;
83; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
84; IS__CGSCC____-LABEL: define {{[^@]+}}@cb2
85; IS__CGSCC____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
86; IS__CGSCC____-NEXT:  entry:
87; IS__CGSCC____-NEXT:    ret i32 [[UNKNOWN]]
88;
89entry:
90  %call = call i32 @cb0(i32 0)
91  ret i32 %unknown
92}
93
94define internal i32 @cb3(i32 %unknown) {
95; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
96; IS__TUNIT____-LABEL: define {{[^@]+}}@cb3
97; IS__TUNIT____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
98; IS__TUNIT____-NEXT:  entry:
99; IS__TUNIT____-NEXT:    ret i32 [[UNKNOWN]]
100;
101; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
102; IS__CGSCC____-LABEL: define {{[^@]+}}@cb3
103; IS__CGSCC____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
104; IS__CGSCC____-NEXT:  entry:
105; IS__CGSCC____-NEXT:    ret i32 [[UNKNOWN]]
106;
107entry:
108  ret i32 %unknown
109}
110
111define internal i32 @cb4(i32 %unknown) {
112; IS__TUNIT____: Function Attrs: nofree nosync nounwind readnone willreturn
113; IS__TUNIT____-LABEL: define {{[^@]+}}@cb4
114; IS__TUNIT____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
115; IS__TUNIT____-NEXT:  entry:
116; IS__TUNIT____-NEXT:    ret i32 [[UNKNOWN]]
117;
118; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
119; IS__CGSCC____-LABEL: define {{[^@]+}}@cb4
120; IS__CGSCC____-SAME: (i32 noundef returned [[UNKNOWN:%.*]]) [[ATTR0]] {
121; IS__CGSCC____-NEXT:  entry:
122; IS__CGSCC____-NEXT:    ret i32 [[UNKNOWN]]
123;
124entry:
125  ret i32 %unknown
126}
127
128define void @foo() {
129; CHECK-LABEL: define {{[^@]+}}@foo() {
130; CHECK-NEXT:  entry:
131; CHECK-NEXT:    call void @broker(i32 (i32)* noundef nonnull @cb0, i32 (i32)* noundef nonnull @cb1, i32 (i32)* noundef nonnull @cb0, i32 noundef 0, i32 noundef 1)
132; CHECK-NEXT:    call void @broker(i32 (i32)* noundef nonnull @cb1, i32 (i32)* noundef nonnull @cb2, i32 (i32)* noundef nonnull @cb2, i32 noundef 0, i32 noundef 1)
133; CHECK-NEXT:    call void @broker(i32 (i32)* noundef nonnull @cb3, i32 (i32)* noundef nonnull @cb2, i32 (i32)* noundef nonnull @cb3, i32 noundef 0, i32 noundef 1)
134; CHECK-NEXT:    call void @broker(i32 (i32)* noundef nonnull @cb4, i32 (i32)* noundef nonnull @cb4, i32 (i32)* noundef nonnull @cb4, i32 noundef 0, i32 noundef 1)
135; CHECK-NEXT:    ret void
136;
137entry:
138  %call = call i32 @cb0(i32 0)
139  %call1 = call i32 @cb3(i32 1)
140  call void @broker(i32 (i32)* nonnull @cb0, i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb0, i32 0, i32 1)
141  call void @broker(i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb2, i32 0, i32 1)
142  call void @broker(i32 (i32)* nonnull @cb3, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb3, i32 0, i32 1)
143  call void @broker(i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 0, i32 1)
144  ret void
145}
146
147declare !callback !3 void @broker(i32 (i32)*, i32 (i32)*, i32 (i32)*, i32, i32)
148
149!0 = !{i64 0, i64 3, i1 false}
150!1 = !{i64 1, i64 4, i1 false}
151!2 = !{i64 2, i64 3, i1 false}
152!3 = !{!0, !2, !1}
153