llvm.org GIT mirror llvm / testing test / CodeGen / ARM / memfunc.ll
testing

Tree @testing (Download .tar.gz)

memfunc.ll @testingraw · history · blame

  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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
; RUN: llc < %s -mtriple=armv7-apple-ios -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-IOS --check-prefix=CHECK
; RUN: llc < %s -mtriple=thumbv7m-none-macho -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-DARWIN --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-eabi -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-EABI --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-eabihf -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-EABI --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-androideabi -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-EABI --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-gnueabi -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-GNUEABI --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-gnueabihf -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-GNUEABI --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-musleabi -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-GNUEABI --check-prefix=CHECK
; RUN: llc < %s -mtriple=arm-none-musleabihf -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-GNUEABI --check-prefix=CHECK

define void @f1(i8* %dest, i8* %src) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f1

  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 0, i1 false)

  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 0, i1 false)

  ; EABI memset swaps arguments
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 1, i32 500, i32 0, i1 false)

  ; EABI uses memclr if value set to 0
  ; CHECK-IOS: mov r1, #0
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #0
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: bl __aeabi_memclr
  ; CHECK-GNUEABI: bl memset
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 500, i32 0, i1 false)

  ; EABI uses aligned function variants if possible

  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove4
  ; CHECK-GNUEABI: bl memmove
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 4, i1 false)

  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy4
  ; CHECK-GNUEABI: bl memcpy
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 4, i1 false)

  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: bl __aeabi_memset4
  ; CHECK-GNUEABI: bl memset
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 1, i32 500, i32 4, i1 false)

  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: bl __aeabi_memclr4
  ; CHECK-GNUEABI: bl memset
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 500, i32 4, i1 false)

  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove8
  ; CHECK-GNUEABI: bl memmove
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 8, i1 false)

  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy8
  ; CHECK-GNUEABI: bl memcpy
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %src, i32 500, i32 8, i1 false)

  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: bl __aeabi_memset8
  ; CHECK-GNUEABI: bl memset
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 1, i32 500, i32 8, i1 false)

  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: bl __aeabi_memclr8
  ; CHECK-GNUEABI: bl memset
  call void @llvm.memset.p0i8.i32(i8* %dest, i8 0, i32 500, i32 8, i1 false)

  unreachable
}

; Check that alloca arguments to memory intrinsics are automatically aligned if at least 8 bytes in size
define void @f2(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f2

  ; IOS (ARMv7) should 8-byte align, others should 4-byte align
  ; CHECK-IOS: add r1, sp, #32
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: add r1, sp, #28
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: {{add r1, sp, #28|sub r1, r(7|11), #20}}
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: {{add r1, sp, #28|sub r1, r(7|11), #20}}
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [9 x i8], align 1
  %0 = bitcast [9 x i8]* %arr0 to i8*
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: add r1, sp, #16
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [9 x i8], align 1
  %1 = bitcast [9 x i8]* %arr1 to i8*
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK-IOS: mov r0, sp
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: add r0, sp, #4
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: add r0, sp, #4
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: add r0, sp, #4
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [9 x i8], align 1
  %2 = bitcast [9 x i8]* %arr2 to i8*
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that alloca arguments are not aligned if less than 8 bytes in size
define void @f3(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f3

  ; CHECK: {{add(.w)? r1, sp, #17|sub(.w)? r1, r(7|11), #15}}
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [7 x i8], align 1
  %0 = bitcast [7 x i8]* %arr0 to i8*
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r1, sp, #10|sub(.w)? r1, r(7|11), #22}}
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [7 x i8], align 1
  %1 = bitcast [7 x i8]* %arr1 to i8*
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r0, sp, #3|sub(.w)? r0, r(7|11), #29}}
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [7 x i8], align 1
  %2 = bitcast [7 x i8]* %arr2 to i8*
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that alloca arguments are not aligned if size+offset is less than 8 bytes
define void @f4(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f4

  ; CHECK: {{add(.w)? r., sp, #23|sub(.w)? r., r(7|11), #17}}
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [9 x i8], align 1
  %0 = getelementptr inbounds [9 x i8], [9 x i8]* %arr0, i32 0, i32 4
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(10|14)|sub(.w) r., r(7|11), #26}}
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [9 x i8], align 1
  %1 = getelementptr inbounds [9 x i8], [9 x i8]* %arr1, i32 0, i32 4
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(1|5)|sub(.w) r., r(7|11), #35}}
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [9 x i8], align 1
  %2 = getelementptr inbounds [9 x i8], [9 x i8]* %arr2, i32 0, i32 4
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that alloca arguments are not aligned if the offset is not a multiple of 4
define void @f5(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f5

  ; CHECK: {{add(.w)? r., sp, #27|sub(.w)? r., r(7|11), #21}}
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [13 x i8], align 1
  %0 = getelementptr inbounds [13 x i8], [13 x i8]* %arr0, i32 0, i32 1
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(10|14)|sub(.w)? r., r(7|11), #34}}
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [13 x i8], align 1
  %1 = getelementptr inbounds [13 x i8], [13 x i8]* %arr1, i32 0, i32 1
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(1|5)|sub(.w)? r., r(7|11), #47}}
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [13 x i8], align 1
  %2 = getelementptr inbounds [13 x i8], [13 x i8]* %arr2, i32 0, i32 1
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that alloca arguments are not aligned if the offset is unknown
define void @f6(i8* %dest, i32 %n, i32 %i) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f6

  ; CHECK: {{add(.w)? r., sp, #27|sub(.w)? r., r(7|11), #(25|29)}}
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [13 x i8], align 1
  %0 = getelementptr inbounds [13 x i8], [13 x i8]* %arr0, i32 0, i32 %i
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(10|14)|sub(.w)? r., r(7|11), #42}}
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [13 x i8], align 1
  %1 = getelementptr inbounds [13 x i8], [13 x i8]* %arr1, i32 0, i32 %i
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(1|5)|sub(.w)? r., r(7|11), #55}}
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [13 x i8], align 1
  %2 = getelementptr inbounds [13 x i8], [13 x i8]* %arr2, i32 0, i32 %i
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that alloca arguments are not aligned if the GEP is not inbounds
define void @f7(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f7

  ; CHECK: {{add(.w)? r., sp, #27|sub(.w)? r., r(7|11), #21}}
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [13 x i8], align 1
  %0 = getelementptr [13 x i8], [13 x i8]* %arr0, i32 0, i32 4
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(10|14)|sub(.w)? r., r(7|11), #34}}
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [13 x i8], align 1
  %1 = getelementptr [13 x i8], [13 x i8]* %arr1, i32 0, i32 4
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(1|5)|sub(.w)? r., r(7|11), #47}}
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [13 x i8], align 1
  %2 = getelementptr [13 x i8], [13 x i8]* %arr2, i32 0, i32 4
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that alloca arguments are not aligned when the offset is past the end of the allocation
define void @f8(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  ; CHECK-LABEL: f8

  ; CHECK: {{add(.w)? r., sp, #27|sub(.w)? r., r(7|11), #21}}
  ; CHECK-IOS: bl _memmove
  ; CHECK-DARWIN: bl _memmove
  ; CHECK-EABI: bl __aeabi_memmove
  ; CHECK-GNUEABI: bl memmove
  %arr0 = alloca [13 x i8], align 1
  %0 = getelementptr inbounds [13 x i8], [13 x i8]* %arr0, i32 0, i32 16
  call void @llvm.memmove.p0i8.p0i8.i32(i8* %dest, i8* %0, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(10|14)|sub(.w)? r., r(7|11), #34}}
  ; CHECK-IOS: bl _memcpy
  ; CHECK-DARWIN: bl _memcpy
  ; CHECK-EABI: bl __aeabi_memcpy
  ; CHECK-GNUEABI: bl memcpy
  %arr1 = alloca [13 x i8], align 1
  %1 = getelementptr inbounds [13 x i8], [13 x i8]* %arr1, i32 0, i32 16
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* %1, i32 %n, i32 0, i1 false)

  ; CHECK: {{add(.w)? r., sp, #(1|5)|sub(.w)? r., r(7|11), #47}}
  ; CHECK-IOS: mov r1, #1
  ; CHECK-IOS: bl _memset
  ; CHECK-DARWIN: movs r1, #1
  ; CHECK-DARWIN: bl _memset
  ; CHECK-EABI: mov r2, #1
  ; CHECK-EABI: bl __aeabi_memset
  ; CHECK-GNUEABI: mov r1, #1
  ; CHECK-GNUEABI: bl memset
  %arr2 = alloca [13 x i8], align 1
  %2 = getelementptr inbounds [13 x i8], [13 x i8]* %arr2, i32 0, i32 16
  call void @llvm.memset.p0i8.i32(i8* %2, i8 1, i32 %n, i32 0, i1 false)

  unreachable
}

; Check that global variables are aligned if they are large enough, but only if
; they are defined in this object and don't have an explicit section.
@arr1 = global [7 x i8] c"\01\02\03\04\05\06\07", align 1
@arr2 = global [8 x i8] c"\01\02\03\04\05\06\07\08", align 1
@arr3 = global [7 x i8] c"\01\02\03\04\05\06\07", section "foo,bar", align 1
@arr4 = global [8 x i8] c"\01\02\03\04\05\06\07\08", section "foo,bar", align 1
@arr5 = weak global [7 x i8] c"\01\02\03\04\05\06\07", align 1
@arr6 = weak_odr global [7 x i8] c"\01\02\03\04\05\06\07", align 1
@arr7 = external global [7 x i8], align 1
@arr8 = internal global [128 x i8] undef
@arr9 = weak_odr global [128 x i8] undef
define void @f9(i8* %dest, i32 %n) "no-frame-pointer-elim"="true" {
entry:
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arr1, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @arr2, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arr3, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @arr4, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arr5, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arr6, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @arr7, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @arr8, i32 0, i32 0), i32 %n, i32 1, i1 false)
  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dest, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @arr9, i32 0, i32 0), i32 %n, i32 1, i1 false)

  unreachable
}

; CHECK: {{\.data|\.section.+data}}
; CHECK-NOT: .p2align
; CHECK: arr1:
; CHECK-IOS: .p2align 3
; CHECK-DARWIN: .p2align 2
; CHECK-EABI-NOT: .p2align
; CHECK-GNUEABI-NOT: .p2align
; CHECK: arr2:
; CHECK: {{\.section.+foo,bar}}
; CHECK-NOT: .p2align
; CHECK: arr3:
; CHECK-NOT: .p2align
; CHECK: arr4:
; CHECK: {{\.data|\.section.+data}}
; CHECK-NOT: .p2align
; CHECK: arr5:
; CHECK-NOT: .p2align
; CHECK: arr6:
; CHECK: .p2align 4
; CHECK: arr8:
; CHECK: .p2align 4
; CHECK: arr9:

; CHECK-NOT: arr7:

declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind