1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6 @a = common global [60 x i8] zeroinitializer, align 1
7 @b = common global [60 x i8] zeroinitializer, align 1
8 @.str = private constant [12 x i8] c"abcdefghijk\00"
10 %struct.__va_list_tag = type { i32, i32, i8*, i8* }
12 define i8* @test_memccpy() {
13 ; CHECK-LABEL: @test_memccpy(
14 ; CHECK-NEXT: [[MEMCCPY:%.*]] = call i8* @memccpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i32 0, i64 60)
15 ; CHECK-NEXT: ret i8* [[MEMCCPY]]
17 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
18 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
19 %ret = call i8* @__memccpy_chk(i8* %dst, i8* %src, i32 0, i64 60, i64 -1)
23 define i8* @test_not_memccpy() {
24 ; CHECK-LABEL: @test_not_memccpy(
25 ; CHECK-NEXT: [[RET:%.*]] = call i8* @__memccpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i32 0, i64 60, i64 59)
26 ; CHECK-NEXT: ret i8* [[RET]]
28 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
29 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
30 %ret = call i8* @__memccpy_chk(i8* %dst, i8* %src, i32 0, i64 60, i64 59)
34 define i8* @test_memccpy_tail() {
35 ; CHECK-LABEL: @test_memccpy_tail(
36 ; CHECK-NEXT: [[MEMCCPY:%.*]] = tail call i8* @memccpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i32 0, i64 60)
37 ; CHECK-NEXT: ret i8* [[MEMCCPY]]
39 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
40 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
41 %ret = tail call i8* @__memccpy_chk(i8* %dst, i8* %src, i32 0, i64 60, i64 -1)
45 define i8* @test_mempcpy() {
46 ; CHECK-LABEL: @test_mempcpy(
47 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(15) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull align 1 dereferenceable(15) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 15, i1 false)
48 ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 15)
50 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
51 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
52 %ret = call i8* @__mempcpy_chk(i8* %dst, i8* %src, i64 15, i64 -1)
56 define i8* @test_not_mempcpy() {
57 ; CHECK-LABEL: @test_not_mempcpy(
58 ; CHECK-NEXT: [[RET:%.*]] = call i8* @__mempcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 60, i64 59)
59 ; CHECK-NEXT: ret i8* [[RET]]
61 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
62 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
63 %ret = call i8* @__mempcpy_chk(i8* %dst, i8* %src, i64 60, i64 59)
67 define i8* @test_mempcpy_tail() {
68 ; CHECK-LABEL: @test_mempcpy_tail(
69 ; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noundef nonnull align 1 dereferenceable(15) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull align 1 dereferenceable(15) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 15, i1 false)
70 ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 15)
72 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
73 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
74 %ret = tail call i8* @__mempcpy_chk(i8* %dst, i8* %src, i64 15, i64 -1)
78 define i32 @test_snprintf() {
79 ; CHECK-LABEL: @test_snprintf(
80 ; CHECK-NEXT: [[SNPRINTF:%.*]] = call i32 (i8*, i64, i8*, ...) @snprintf(i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 60, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
81 ; CHECK-NEXT: ret i32 [[SNPRINTF]]
83 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
84 %fmt = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
85 %ret = call i32 (i8*, i64, i32, i64, i8*, ...) @__snprintf_chk(i8* %dst, i64 60, i32 0, i64 -1, i8* %fmt)
89 define i32 @test_not_snprintf() {
90 ; CHECK-LABEL: @test_not_snprintf(
91 ; CHECK-NEXT: [[RET:%.*]] = call i32 (i8*, i64, i32, i64, i8*, ...) @__snprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 60, i32 0, i64 59, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
92 ; CHECK-NEXT: [[IGN:%.*]] = call i32 (i8*, i64, i32, i64, i8*, ...) @__snprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 60, i32 1, i64 -1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
93 ; CHECK-NEXT: ret i32 [[RET]]
95 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
96 %fmt = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
97 %ret = call i32 (i8*, i64, i32, i64, i8*, ...) @__snprintf_chk(i8* %dst, i64 60, i32 0, i64 59, i8* %fmt)
98 %ign = call i32 (i8*, i64, i32, i64, i8*, ...) @__snprintf_chk(i8* %dst, i64 60, i32 1, i64 -1, i8* %fmt)
102 define i32 @test_snprintf_tail() {
103 ; CHECK-LABEL: @test_snprintf_tail(
104 ; CHECK-NEXT: [[SNPRINTF:%.*]] = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 60, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
105 ; CHECK-NEXT: ret i32 [[SNPRINTF]]
107 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
108 %fmt = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
109 %ret = tail call i32 (i8*, i64, i32, i64, i8*, ...) @__snprintf_chk(i8* %dst, i64 60, i32 0, i64 -1, i8* %fmt)
113 define i32 @test_sprintf() {
114 ; CHECK-LABEL: @test_sprintf(
115 ; CHECK-NEXT: [[SPRINTF:%.*]] = call i32 (i8*, i8*, ...) @sprintf(i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
116 ; CHECK-NEXT: ret i32 [[SPRINTF]]
118 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
119 %fmt = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
120 %ret = call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* %dst, i32 0, i64 -1, i8* %fmt)
124 define i32 @test_not_sprintf() {
125 ; CHECK-LABEL: @test_not_sprintf(
126 ; CHECK-NEXT: [[RET:%.*]] = call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i32 0, i64 59, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
127 ; CHECK-NEXT: [[IGNORED:%.*]] = call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i32 1, i64 -1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
128 ; CHECK-NEXT: ret i32 [[RET]]
130 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
131 %fmt = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
132 %ret = call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* %dst, i32 0, i64 59, i8* %fmt)
133 %ignored = call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* %dst, i32 1, i64 -1, i8* %fmt)
137 define i32 @test_sprintf_tail() {
138 ; CHECK-LABEL: @test_sprintf_tail(
139 ; CHECK-NEXT: [[SPRINTF:%.*]] = tail call i32 (i8*, i8*, ...) @sprintf(i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
140 ; CHECK-NEXT: ret i32 [[SPRINTF]]
142 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
143 %fmt = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
144 %ret = tail call i32 (i8*, i32, i64, i8*, ...) @__sprintf_chk(i8* %dst, i32 0, i64 -1, i8* %fmt)
148 define i8* @test_strcat() {
149 ; CHECK-LABEL: @test_strcat(
150 ; CHECK-NEXT: [[STRCAT:%.*]] = call i8* @strcat(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
151 ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0)
153 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
154 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
155 %ret = call i8* @__strcat_chk(i8* %dst, i8* %src, i64 -1)
159 define i8* @test_not_strcat() {
160 ; CHECK-LABEL: @test_not_strcat(
161 ; CHECK-NEXT: [[RET:%.*]] = call i8* @__strcat_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 0)
162 ; CHECK-NEXT: ret i8* [[RET]]
164 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
165 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
166 %ret = call i8* @__strcat_chk(i8* %dst, i8* %src, i64 0)
170 define i8* @test_strcat_tail() {
171 ; CHECK-LABEL: @test_strcat_tail(
172 ; CHECK-NEXT: [[STRCAT:%.*]] = tail call i8* @strcat(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0))
173 ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0)
175 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
176 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
177 %ret = tail call i8* @__strcat_chk(i8* %dst, i8* %src, i64 -1)
181 define i64 @test_strlcat() {
182 ; CHECK-LABEL: @test_strlcat(
183 ; CHECK-NEXT: [[STRLCAT:%.*]] = call i64 @strlcat(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22)
184 ; CHECK-NEXT: ret i64 [[STRLCAT]]
186 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
187 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
188 %ret = call i64 @__strlcat_chk(i8* %dst, i8* %src, i64 22, i64 -1)
192 define i64 @test_not_strlcat() {
193 ; CHECK-LABEL: @test_not_strlcat(
194 ; CHECK-NEXT: [[RET:%.*]] = call i64 @__strlcat_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22, i64 0)
195 ; CHECK-NEXT: ret i64 [[RET]]
197 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
198 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
199 %ret = call i64 @__strlcat_chk(i8* %dst, i8* %src, i64 22, i64 0)
203 define i64 @test_strlcat_tail() {
204 ; CHECK-LABEL: @test_strlcat_tail(
205 ; CHECK-NEXT: [[STRLCAT:%.*]] = tail call i64 @strlcat(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22)
206 ; CHECK-NEXT: ret i64 [[STRLCAT]]
208 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
209 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
210 %ret = tail call i64 @__strlcat_chk(i8* %dst, i8* %src, i64 22, i64 -1)
214 define i8* @test_strncat() {
215 ; CHECK-LABEL: @test_strncat(
216 ; CHECK-NEXT: [[STRNCAT:%.*]] = call i8* @strncat(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22)
217 ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0)
219 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
220 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
221 %ret = call i8* @__strncat_chk(i8* %dst, i8* %src, i64 22, i64 -1)
225 define i8* @test_not_strncat() {
226 ; CHECK-LABEL: @test_not_strncat(
227 ; CHECK-NEXT: [[RET:%.*]] = call i8* @__strncat_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22, i64 3)
228 ; CHECK-NEXT: ret i8* [[RET]]
230 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
231 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
232 %ret = call i8* @__strncat_chk(i8* %dst, i8* %src, i64 22, i64 3)
236 define i8* @test_strncat_tail() {
237 ; CHECK-LABEL: @test_strncat_tail(
238 ; CHECK-NEXT: [[STRNCAT:%.*]] = tail call i8* @strncat(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22)
239 ; CHECK-NEXT: ret i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0)
241 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
242 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
243 %ret = tail call i8* @__strncat_chk(i8* %dst, i8* %src, i64 22, i64 -1)
247 define i64 @test_strlcpy() {
248 ; CHECK-LABEL: @test_strlcpy(
249 ; CHECK-NEXT: [[STRLCPY:%.*]] = call i64 @strlcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22)
250 ; CHECK-NEXT: ret i64 [[STRLCPY]]
252 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
253 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
254 %ret = call i64 @__strlcpy_chk(i8* %dst, i8* %src, i64 22, i64 -1)
258 define i64 @test_not_strlcpy() {
259 ; CHECK-LABEL: @test_not_strlcpy(
260 ; CHECK-NEXT: [[RET:%.*]] = call i64 @__strlcpy_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22, i64 2)
261 ; CHECK-NEXT: ret i64 [[RET]]
263 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
264 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
265 %ret = call i64 @__strlcpy_chk(i8* %dst, i8* %src, i64 22, i64 2)
269 define i64 @test_strlcpy_tail() {
270 ; CHECK-LABEL: @test_strlcpy_tail(
271 ; CHECK-NEXT: [[STRLCPY:%.*]] = tail call i64 @strlcpy(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), i64 22)
272 ; CHECK-NEXT: ret i64 [[STRLCPY]]
274 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
275 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
276 %ret = tail call i64 @__strlcpy_chk(i8* %dst, i8* %src, i64 22, i64 -1)
280 define i32 @test_vsnprintf() {
281 ; CHECK-LABEL: @test_vsnprintf(
282 ; CHECK-NEXT: [[VSNPRINTF:%.*]] = call i32 @vsnprintf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 4, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
283 ; CHECK-NEXT: ret i32 [[VSNPRINTF]]
286 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
287 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
288 %ret = call i32 @__vsnprintf_chk(i8* %dst, i64 4, i32 0, i64 -1, i8* %src, %struct.__va_list_tag* null)
292 define i32 @test_not_vsnprintf() {
293 ; CHECK-LABEL: @test_not_vsnprintf(
294 ; CHECK-NEXT: [[RET:%.*]] = call i32 @__vsnprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 4, i32 0, i64 3, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
295 ; CHECK-NEXT: [[IGN:%.*]] = call i32 @__vsnprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 4, i32 1, i64 -1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
296 ; CHECK-NEXT: ret i32 [[RET]]
299 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
300 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
301 %ret = call i32 @__vsnprintf_chk(i8* %dst, i64 4, i32 0, i64 3, i8* %src, %struct.__va_list_tag* null)
302 %ign = call i32 @__vsnprintf_chk(i8* %dst, i64 4, i32 1, i64 -1, i8* %src, %struct.__va_list_tag* null)
306 define i32 @test_vsnprintf_tail() {
307 ; CHECK-LABEL: @test_vsnprintf_tail(
308 ; CHECK-NEXT: [[VSNPRINTF:%.*]] = tail call i32 @vsnprintf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i64 4, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
309 ; CHECK-NEXT: ret i32 [[VSNPRINTF]]
312 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
313 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
314 %ret = tail call i32 @__vsnprintf_chk(i8* %dst, i64 4, i32 0, i64 -1, i8* %src, %struct.__va_list_tag* null)
318 define i32 @test_vsprintf() {
319 ; CHECK-LABEL: @test_vsprintf(
320 ; CHECK-NEXT: [[VSPRINTF:%.*]] = call i32 @vsprintf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
321 ; CHECK-NEXT: ret i32 [[VSPRINTF]]
324 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
325 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
326 %ret = call i32 @__vsprintf_chk(i8* %dst, i32 0, i64 -1, i8* %src, %struct.__va_list_tag* null)
330 define i32 @test_not_vsprintf() {
331 ; CHECK-LABEL: @test_not_vsprintf(
332 ; CHECK-NEXT: [[RET:%.*]] = call i32 @__vsprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i32 0, i64 3, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
333 ; CHECK-NEXT: [[IGN:%.*]] = call i32 @__vsprintf_chk(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i32 1, i64 -1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
334 ; CHECK-NEXT: ret i32 [[RET]]
337 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
338 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
339 %ret = call i32 @__vsprintf_chk(i8* %dst, i32 0, i64 3, i8* %src, %struct.__va_list_tag* null)
340 %ign = call i32 @__vsprintf_chk(i8* %dst, i32 1, i64 -1, i8* %src, %struct.__va_list_tag* null)
344 define i32 @test_vsprintf_tail() {
345 ; CHECK-LABEL: @test_vsprintf_tail(
346 ; CHECK-NEXT: [[VSPRINTF:%.*]] = tail call i32 @vsprintf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @a, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @b, i64 0, i64 0), %struct.__va_list_tag* null)
347 ; CHECK-NEXT: ret i32 [[VSPRINTF]]
350 %dst = getelementptr inbounds [60 x i8], [60 x i8]* @a, i32 0, i32 0
351 %src = getelementptr inbounds [60 x i8], [60 x i8]* @b, i32 0, i32 0
352 %ret = tail call i32 @__vsprintf_chk(i8* %dst, i32 0, i64 -1, i8* %src, %struct.__va_list_tag* null)
356 declare i8* @__mempcpy_chk(i8*, i8*, i64, i64)
357 declare i8* @__memccpy_chk(i8*, i8*, i32, i64, i64)
358 declare i32 @__snprintf_chk(i8*, i64, i32, i64, i8*, ...)
359 declare i32 @__sprintf_chk(i8*, i32, i64, i8*, ...)
360 declare i8* @__strcat_chk(i8*, i8*, i64)
361 declare i64 @__strlcat_chk(i8*, i8*, i64, i64)
362 declare i8* @__strncat_chk(i8*, i8*, i64, i64)
363 declare i64 @__strlcpy_chk(i8*, i8*, i64, i64)
364 declare i32 @__vsnprintf_chk(i8*, i64, i32, i64, i8*, %struct.__va_list_tag*)
365 declare i32 @__vsprintf_chk(i8*, i32, i64, i8*, %struct.__va_list_tag*)