1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes --check-globals
2 ; call site specific analysis is disabled
4 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
6 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
8 define dso_local i32 @test_range1(i32 %0) #0 {
9 ; CHECK-LABEL: define {{[^@]+}}@test_range1
10 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
11 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP0]], 0
12 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
14 ; CHECK-NEXT: br label [[TMP5:%.*]]
16 ; CHECK-NEXT: br label [[TMP5]]
18 ; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 100, [[TMP3]] ], [ 0, [[TMP4]] ]
19 ; CHECK-NEXT: ret i32 [[DOT0]]
21 %2 = icmp ne i32 %0, 0
22 br i1 %2, label %3, label %4
31 %.0 = phi i32 [ 100, %3 ], [ 0, %4 ]
35 define i32 @test_range2(i32 %0) #0 {
36 ; CHECK-LABEL: define {{[^@]+}}@test_range2
37 ; CHECK-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
38 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP0]], 0
39 ; CHECK-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]]
41 ; CHECK-NEXT: br label [[TMP5:%.*]]
43 ; CHECK-NEXT: br label [[TMP5]]
45 ; CHECK-NEXT: [[DOT0:%.*]] = phi i32 [ 100, [[TMP3]] ], [ 200, [[TMP4]] ]
46 ; CHECK-NEXT: ret i32 [[DOT0]]
48 %2 = icmp ne i32 %0, 0
49 br i1 %2, label %3, label %4
58 %.0 = phi i32 [ 100, %3 ], [ 200, %4 ]
61 define i32 @test(i32 %0, i32 %1) #0 {
62 ; TUNIT-LABEL: define {{[^@]+}}@test
63 ; TUNIT-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
64 ; TUNIT-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0
65 ; TUNIT-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]
67 ; TUNIT-NEXT: [[TMP5:%.*]] = call i32 @test_range1(i32 [[TMP0]])
68 ; TUNIT-NEXT: br label [[TMP8:%.*]]
70 ; TUNIT-NEXT: [[TMP7:%.*]] = call i32 @test_range2(i32 [[TMP0]])
71 ; TUNIT-NEXT: br label [[TMP8]]
73 ; TUNIT-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]
74 ; TUNIT-NEXT: ret i32 [[DOT0]]
76 ; CGSCC-LABEL: define {{[^@]+}}@test
77 ; CGSCC-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR1:[0-9]+]] {
78 ; CGSCC-NEXT: [[TMP3:%.*]] = icmp ne i32 [[TMP1]], 0
79 ; CGSCC-NEXT: br i1 [[TMP3]], label [[TMP4:%.*]], label [[TMP6:%.*]]
81 ; CGSCC-NEXT: [[TMP5:%.*]] = call noundef i32 @test_range1(i32 [[TMP0]])
82 ; CGSCC-NEXT: br label [[TMP8:%.*]]
84 ; CGSCC-NEXT: [[TMP7:%.*]] = call noundef i32 @test_range2(i32 [[TMP0]])
85 ; CGSCC-NEXT: br label [[TMP8]]
87 ; CGSCC-NEXT: [[DOT0:%.*]] = phi i32 [ [[TMP5]], [[TMP4]] ], [ [[TMP7]], [[TMP6]] ]
88 ; CGSCC-NEXT: ret i32 [[DOT0]]
90 %3 = icmp ne i32 %1, 0
91 br i1 %3, label %4, label %6
94 %5 = call i32 @test_range1(i32 %0)
98 %7 = call i32 @test_range2(i32 %0)
102 %.0 = phi i32 [ %5, %4 ], [ %7, %6 ]
106 define i32 @test_pcheck1(i32 %0) #0 {
107 ; TUNIT-LABEL: define {{[^@]+}}@test_pcheck1
108 ; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
109 ; TUNIT-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
110 ; TUNIT-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101
111 ; TUNIT-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
112 ; TUNIT-NEXT: ret i32 [[TMP4]]
114 ; CGSCC-LABEL: define {{[^@]+}}@test_pcheck1
115 ; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {
116 ; CGSCC-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
117 ; CGSCC-NEXT: [[TMP3:%.*]] = icmp slt i32 [[TMP2]], 101
118 ; CGSCC-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
119 ; CGSCC-NEXT: ret i32 [[TMP4]]
121 %2 = call i32 @test(i32 %0, i32 1)
122 %3 = icmp slt i32 %2, 101
123 %4 = zext i1 %3 to i32
127 define i32 @test_pcheck2(i32 %0) #0 {
128 ; TUNIT-LABEL: define {{[^@]+}}@test_pcheck2
129 ; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
130 ; TUNIT-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
131 ; TUNIT-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99
132 ; TUNIT-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
133 ; TUNIT-NEXT: ret i32 [[TMP4]]
135 ; CGSCC-LABEL: define {{[^@]+}}@test_pcheck2
136 ; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {
137 ; CGSCC-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
138 ; CGSCC-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 99
139 ; CGSCC-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
140 ; CGSCC-NEXT: ret i32 [[TMP4]]
142 %2 = call i32 @test(i32 %0, i32 0)
143 %3 = icmp sgt i32 %2, 99
144 %4 = zext i1 %3 to i32
148 define i32 @test_ncheck1(i32 %0) #0 {
149 ; TUNIT-LABEL: define {{[^@]+}}@test_ncheck1
150 ; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
151 ; TUNIT-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
152 ; TUNIT-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50
153 ; TUNIT-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
154 ; TUNIT-NEXT: ret i32 [[TMP4]]
156 ; CGSCC-LABEL: define {{[^@]+}}@test_ncheck1
157 ; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {
158 ; CGSCC-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 1)
159 ; CGSCC-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 50
160 ; CGSCC-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
161 ; CGSCC-NEXT: ret i32 [[TMP4]]
163 %2 = call i32 @test(i32 %0, i32 1)
164 %3 = icmp sgt i32 %2, 50
165 %4 = zext i1 %3 to i32
169 define i32 @test_ncheck2(i32 %0) #0 {
170 ; TUNIT-LABEL: define {{[^@]+}}@test_ncheck2
171 ; TUNIT-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] {
172 ; TUNIT-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
173 ; TUNIT-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150
174 ; TUNIT-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
175 ; TUNIT-NEXT: ret i32 [[TMP4]]
177 ; CGSCC-LABEL: define {{[^@]+}}@test_ncheck2
178 ; CGSCC-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1]] {
179 ; CGSCC-NEXT: [[TMP2:%.*]] = call i32 @test(i32 [[TMP0]], i32 noundef 0)
180 ; CGSCC-NEXT: [[TMP3:%.*]] = icmp sgt i32 [[TMP2]], 150
181 ; CGSCC-NEXT: [[TMP4:%.*]] = zext i1 [[TMP3]] to i32
182 ; CGSCC-NEXT: ret i32 [[TMP4]]
184 %2 = call i32 @test(i32 %0, i32 0)
185 %3 = icmp sgt i32 %2, 150
186 %4 = zext i1 %3 to i32
190 attributes #0 = { noinline nounwind sspstrong uwtable}
192 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }
193 ; TUNIT: attributes #[[ATTR1:[0-9]+]] = { nofree nosync nounwind willreturn memory(none) }
195 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind sspstrong willreturn memory(none) uwtable }
196 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline nosync nounwind sspstrong willreturn memory(none) uwtable }
197 ; CGSCC: attributes #[[ATTR2:[0-9]+]] = { nofree nosync willreturn }