File: strlcpy-1.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (344 lines) | stat: -rw-r--r-- 16,043 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; Assertions have been autogenerated by utils/update_test_checks.py
;
; RUN: opt < %s -data-layout="E" -passes=instcombine -S | FileCheck %s --check-prefixes=ANY,BE
; RUN: opt < %s -data-layout="e" -passes=instcombine -S | FileCheck %s --check-prefixes=ANY,LE
;
; Test that the strncpy library call simplifier works correctly.

declare i64 @strlcpy(ptr, ptr, i64)

declare void @sink(ptr, i64)


@s4 = constant [5 x i8] c"1234\00"


; Verify that strlcpy(D, "", N) calls are transformed to a nul store
; to *D for nonzero N and folded to zero for all values of N.

define void @fold_strlcpy_s0(ptr %dst) {
; ANY-LABEL: @fold_strlcpy_s0(
; ANY-NEXT:    call void @sink(ptr [[DST:%.*]], i64 0)
; ANY-NEXT:    store i8 0, ptr [[DST]], align 1
; ANY-NEXT:    call void @sink(ptr nonnull [[DST]], i64 0)
; ANY-NEXT:    store i8 0, ptr [[DST]], align 1
; ANY-NEXT:    call void @sink(ptr nonnull [[DST]], i64 0)
; ANY-NEXT:    ret void
;
  %ps0 = getelementptr [5 x i8], ptr @s4, i32 0, i32 4

; Fold strlcpy(D, "", 0) to just 0.
  %ns0_0 = call i64 @strlcpy(ptr %dst, ptr %ps0, i64 0)
  call void @sink(ptr %dst, i64 %ns0_0)

; Transform strlcpy(D, "", 1) to *D = '\0, 0.
  %ns0_1 = call i64 @strlcpy(ptr %dst, ptr %ps0, i64 1)
  call void @sink(ptr %dst, i64 %ns0_1)

; Transform strlcpy(D, "", SIZE_MAX) to *D = '\0, 0.
  %ns0_m1 = call i64 @strlcpy(ptr %dst, ptr %ps0, i64 -1)
  call void @sink(ptr %dst, i64 %ns0_m1)

  ret void
}


; Verify that strlcpy(D, "4", N) calls are transformed to a store to
; D[0] for nonzero N (and a nul store to D[1] for N greater than 1)
; and folded to 1 for all values of N.

define void @fold_strlcpy_s1(ptr %dst) {
; BE-LABEL: @fold_strlcpy_s1(
; BE-NEXT:    call void @sink(ptr [[DST:%.*]], i64 1)
; BE-NEXT:    store i8 0, ptr [[DST]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; BE-NEXT:    store i16 13312, ptr [[DST]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; BE-NEXT:    store i16 13312, ptr [[DST]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; BE-NEXT:    store i16 13312, ptr [[DST]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; BE-NEXT:    ret void
;
; LE-LABEL: @fold_strlcpy_s1(
; LE-NEXT:    call void @sink(ptr [[DST:%.*]], i64 1)
; LE-NEXT:    store i8 0, ptr [[DST]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; LE-NEXT:    store i16 52, ptr [[DST]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; LE-NEXT:    store i16 52, ptr [[DST]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; LE-NEXT:    store i16 52, ptr [[DST]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 1)
; LE-NEXT:    ret void
;
  %ps1 = getelementptr [5 x i8], ptr @s4, i32 0, i32 3

; Fold strlcpy(D, "4", 0) to 1.
  %ns1_0 = call i64 @strlcpy(ptr %dst, ptr %ps1, i64 0)
  call void @sink(ptr %dst, i64 %ns1_0)

; Transform strlcpy(D, "4", 1) to *D = '\0', 1.
  %ns1_1 = call i64 @strlcpy(ptr %dst, ptr %ps1, i64 1)
  call void @sink(ptr %dst, i64 %ns1_1)

; Transform strlcpy(D, "4", 2) to D[0] = '\4, D[1] = '\0', 1.
  %ns1_2 = call i64 @strlcpy(ptr %dst, ptr %ps1, i64 2)
  call void @sink(ptr %dst, i64 %ns1_2)

; Transform strlcpy(D, "4", 3) to D[0] = '\4, D[1] = '\0', 1..
  %ns1_3 = call i64 @strlcpy(ptr %dst, ptr %ps1, i64 3)
  call void @sink(ptr %dst, i64 %ns1_3)

; Transform strlcpy(D, "4", SIZE_MAX) to D[0] = '\4, D[1] = '\0', 1.
  %ns1_m1 = call i64 @strlcpy(ptr %dst, ptr %ps1, i64 -1)
  call void @sink(ptr %dst, i64 %ns1_m1)

  ret void
}


; Verify that strlcpy(D, "1234", N) calls are transformed to a copy of
; the N - 1 leading characters of the string to D and folded to 4 for
; all values of N.

define void @fold_strlcpy_s5(ptr %dst) {
; BE-LABEL: @fold_strlcpy_s5(
; BE-NEXT:    call void @sink(ptr [[DST:%.*]], i64 4)
; BE-NEXT:    store i8 0, ptr [[DST]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    store i8 49, ptr [[DST]], align 1
; BE-NEXT:    [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1
; BE-NEXT:    store i8 0, ptr [[TMP1]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    store i16 12594, ptr [[DST]], align 1
; BE-NEXT:    [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 2
; BE-NEXT:    store i8 0, ptr [[TMP2]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) [[DST]], ptr noundef nonnull align 1 dereferenceable(3) @s4, i64 3, i1 false)
; BE-NEXT:    [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3
; BE-NEXT:    store i8 0, ptr [[TMP3]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @s4, i64 5, i1 false)
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @s4, i64 5, i1 false)
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @s4, i64 5, i1 false)
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; BE-NEXT:    ret void
;
; LE-LABEL: @fold_strlcpy_s5(
; LE-NEXT:    call void @sink(ptr [[DST:%.*]], i64 4)
; LE-NEXT:    store i8 0, ptr [[DST]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    store i8 49, ptr [[DST]], align 1
; LE-NEXT:    [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1
; LE-NEXT:    store i8 0, ptr [[TMP1]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    store i16 12849, ptr [[DST]], align 1
; LE-NEXT:    [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 2
; LE-NEXT:    store i8 0, ptr [[TMP2]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) [[DST]], ptr noundef nonnull align 1 dereferenceable(3) @s4, i64 3, i1 false)
; LE-NEXT:    [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 3
; LE-NEXT:    store i8 0, ptr [[TMP3]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @s4, i64 5, i1 false)
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @s4, i64 5, i1 false)
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @s4, i64 5, i1 false)
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 4)
; LE-NEXT:    ret void
;

; Fold strlcpy(D, "1234", 0) to 4.
  %ns4_0 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 0)
  call void @sink(ptr %dst, i64 %ns4_0)

; Transform strlcpy(D, "1234", 1) to *D = '\0', 4.
  %ns4_1 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 1)
  call void @sink(ptr %dst, i64 %ns4_1)

; Transform strlcpy(D, "1234", 2) to D[0] = '1', D[1] = '\0', 4.
  %ns4_2 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 2)
  call void @sink(ptr %dst, i64 %ns4_2)

; Transform strlcpy(D, S="1234", 3) to memcpy(D, S, 2), D[2] = '\0', 4.
  %ns4_3 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 3)
  call void @sink(ptr %dst, i64 %ns4_3)

; Transform strlcpy(D, S="1234", 4) to memcpy(D, S, 3), D[3] = '\0', 4.
  %ns4_4 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 4)
  call void @sink(ptr %dst, i64 %ns4_4)

; Transform strlcpy(D, S="1234", 5) to memcpy(D, S, 5), 4.
  %ns4_5 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 5)
  call void @sink(ptr %dst, i64 %ns4_5)

; Transform strlcpy(D, S="1234", 9) to memcpy(D, S, 5), 4.
  %ns4_9 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 5)
  call void @sink(ptr %dst, i64 %ns4_9)

; Transform strlcpy(D, S="1234", SIZE_MAX) to memcpy(D, S, 5), 4.
  %ns4_m1 = call i64 @strlcpy(ptr %dst, ptr @s4, i64 -1)
  call void @sink(ptr %dst, i64 %ns4_m1)

  ret void
}

; Verify that strlcpy(D, S, 1) calls are transformed into a nul store
; to *D, strlcpy(D, S, 0) to a no-op, and the result of both folded
; to strlen(S).

define void @fold_strlcpy_s_0(ptr %dst, ptr %s, i64 %n) {
; ANY-LABEL: @fold_strlcpy_s_0(
; ANY-NEXT:    store i8 0, ptr [[DST:%.*]], align 1
; ANY-NEXT:    [[STRLEN:%.*]] = call i64 @strlen(ptr noundef nonnull dereferenceable(1) [[S:%.*]])
; ANY-NEXT:    call void @sink(ptr nonnull [[DST]], i64 [[STRLEN]])
; ANY-NEXT:    [[STRLEN1:%.*]] = call i64 @strlen(ptr noundef nonnull dereferenceable(1) [[S]])
; ANY-NEXT:    call void @sink(ptr nonnull [[DST]], i64 [[STRLEN1]])
; ANY-NEXT:    [[STRLEN2:%.*]] = call i64 @strlen(ptr noundef nonnull dereferenceable(1) [[S]])
; ANY-NEXT:    call void @sink(ptr nonnull [[DST]], i64 [[STRLEN2]])
; ANY-NEXT:    ret void
;
; Transform strlcpy(D, S, 1) to *D = '\0', strlen(S).
  %ns_1 = call i64 @strlcpy(ptr %dst, ptr %s, i64 1)
  call void @sink(ptr %dst, i64 %ns_1)

; For strlcpy(D, S, 0) to strlen(S).
  %ns_0 = call i64 @strlcpy(ptr %dst, ptr %s, i64 0)
  call void @sink(ptr %dst, i64 %ns_0)

  ; Verify that calling strlcpy with a null destination is also folded
  ; (to match a possible extension of some implementations that emulate
  ; snprintf(0, 0, "%s", S)).
  %n0_s_0 = call i64 @strlcpy(ptr null, ptr %s, i64 0)
  call void @sink(ptr %dst, i64 %n0_s_0)

  ret void
}


; Verify that strlcpy(D, S, N) calls are left alone when S and/or N are
; not known (except for the cases handled above).  Also verify that they
; annotate the destination argument with the dereferenceable attribute
; only with nonzero N.

define void @call_strlcpy_s0_n(ptr %dst, ptr %s, i64 %n) {
; ANY-LABEL: @call_strlcpy_s0_n(
; ANY-NEXT:    [[NS_2:%.*]] = call i64 @strlcpy(ptr noundef nonnull dereferenceable(1) [[DST:%.*]], ptr noundef nonnull dereferenceable(1) [[S:%.*]], i64 2)
; ANY-NEXT:    call void @sink(ptr [[DST]], i64 [[NS_2]])
; ANY-NEXT:    [[NS_N:%.*]] = call i64 @strlcpy(ptr [[DST]], ptr noundef nonnull dereferenceable(1) [[S]], i64 [[N:%.*]])
; ANY-NEXT:    call void @sink(ptr [[DST]], i64 [[NS_N]])
; ANY-NEXT:    [[NZ:%.*]] = or i64 [[N]], 1
; ANY-NEXT:    [[NS_NZ:%.*]] = call i64 @strlcpy(ptr noundef nonnull dereferenceable(1) [[DST]], ptr noundef nonnull dereferenceable(1) [[S]], i64 [[NZ]])
; ANY-NEXT:    call void @sink(ptr [[DST]], i64 [[NS_NZ]])
; ANY-NEXT:    [[NS0_N:%.*]] = call i64 @strlcpy(ptr [[DST]], ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], ptr @s4, i64 0, i64 4), i64 [[N]])
; ANY-NEXT:    call void @sink(ptr [[DST]], i64 [[NS0_N]])
; ANY-NEXT:    [[NS1_N:%.*]] = call i64 @strlcpy(ptr [[DST]], ptr noundef nonnull dereferenceable(1) getelementptr inbounds ([5 x i8], ptr @s4, i64 0, i64 3), i64 [[N]])
; ANY-NEXT:    call void @sink(ptr [[DST]], i64 [[NS1_N]])
; ANY-NEXT:    [[NS4_N:%.*]] = call i64 @strlcpy(ptr [[DST]], ptr noundef nonnull dereferenceable(1) @s4, i64 [[N]])
; ANY-NEXT:    call void @sink(ptr [[DST]], i64 [[NS4_N]])
; ANY-NEXT:    ret void
;
  %ns_2 = call i64 @strlcpy(ptr %dst, ptr %s, i64 2)
  call void @sink(ptr %dst, i64 %ns_2)

  %ns_n = call i64 @strlcpy(ptr %dst, ptr %s, i64 %n)
  call void @sink(ptr %dst, i64 %ns_n)

  %nz = or i64 %n, 1
  %ns_nz = call i64 @strlcpy(ptr %dst, ptr %s, i64 %nz)
  call void @sink(ptr %dst, i64 %ns_nz)


  %ps0 = getelementptr [5 x i8], ptr @s4, i32 0, i32 4
  %ns0_n = call i64 @strlcpy(ptr %dst, ptr %ps0, i64 %n)
  call void @sink(ptr %dst, i64 %ns0_n)

  %ps1 = getelementptr [5 x i8], ptr @s4, i32 0, i32 3
  %ns1_n = call i64 @strlcpy(ptr %dst, ptr %ps1, i64 %n)
  call void @sink(ptr %dst, i64 %ns1_n)

  %ns4_n = call i64 @strlcpy(ptr %dst, ptr @s4, i64 %n)
  call void @sink(ptr %dst, i64 %ns4_n)

  ret void
}


@a5 = constant [5 x i8] c"12345"

; Verify that the transformation behaves reasonably even when the source
; array is not a nul-terminated string as it's required to be (and doesn't
; for example attempt to read past its end).  All the calls below are
; undefined so technically reading past the end would be fine but it's
; easy to avoid.

define void @fold_strlcpy_a5(ptr %dst, i64 %n) {
; BE-LABEL: @fold_strlcpy_a5(
; BE-NEXT:    call void @sink(ptr [[DST:%.*]], i64 5)
; BE-NEXT:    store i8 0, ptr [[DST]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; BE-NEXT:    store i8 49, ptr [[DST]], align 1
; BE-NEXT:    [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1
; BE-NEXT:    store i8 0, ptr [[TMP1]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; BE-NEXT:    store i32 825373492, ptr [[DST]], align 1
; BE-NEXT:    [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 4
; BE-NEXT:    store i8 0, ptr [[TMP2]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; BE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @a5, i64 5, i1 false)
; BE-NEXT:    [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 5
; BE-NEXT:    store i8 0, ptr [[TMP3]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; BE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @a5, i64 5, i1 false)
; BE-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 5
; BE-NEXT:    store i8 0, ptr [[TMP4]], align 1
; BE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; BE-NEXT:    ret void
;
; LE-LABEL: @fold_strlcpy_a5(
; LE-NEXT:    call void @sink(ptr [[DST:%.*]], i64 5)
; LE-NEXT:    store i8 0, ptr [[DST]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; LE-NEXT:    store i8 49, ptr [[DST]], align 1
; LE-NEXT:    [[TMP1:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 1
; LE-NEXT:    store i8 0, ptr [[TMP1]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; LE-NEXT:    store i32 875770417, ptr [[DST]], align 1
; LE-NEXT:    [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 4
; LE-NEXT:    store i8 0, ptr [[TMP2]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; LE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @a5, i64 5, i1 false)
; LE-NEXT:    [[TMP3:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 5
; LE-NEXT:    store i8 0, ptr [[TMP3]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; LE-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) [[DST]], ptr noundef nonnull align 1 dereferenceable(5) @a5, i64 5, i1 false)
; LE-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 5
; LE-NEXT:    store i8 0, ptr [[TMP4]], align 1
; LE-NEXT:    call void @sink(ptr nonnull [[DST]], i64 5)
; LE-NEXT:    ret void
;
  %na5_0 = call i64 @strlcpy(ptr %dst, ptr @a5, i64 0)
  call void @sink(ptr %dst, i64 %na5_0)

  %na5_1 = call i64 @strlcpy(ptr %dst, ptr @a5, i64 1)
  call void @sink(ptr %dst, i64 %na5_1)

  %na5_2 = call i64 @strlcpy(ptr %dst, ptr @a5, i64 2)
  call void @sink(ptr %dst, i64 %na5_2)

  %na5_5 = call i64 @strlcpy(ptr %dst, ptr @a5, i64 5)
  call void @sink(ptr %dst, i64 %na5_5)

  %na5_6 = call i64 @strlcpy(ptr %dst, ptr @a5, i64 6)
  call void @sink(ptr %dst, i64 %na5_6)

  %na5_9 = call i64 @strlcpy(ptr %dst, ptr @a5, i64 9)
  call void @sink(ptr %dst, i64 %na5_9)

  ret void
}