Change memcpy/memset/memmove to have dest and source alignments.
[oota-llvm.git] / test / Transforms / ScalarRepl / memcpy-align.ll
1 ; RUN: opt -scalarrepl -S < %s | FileCheck %s
2 ; PR6832
3 target datalayout =
4 "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32"
5 target triple = "arm-u-u"
6
7 %0 = type { %struct.anon, %struct.anon }
8 %struct.anon = type { [4 x i8] }
9
10 @c = external global %0                           ; <%0*> [#uses=1]
11
12 define void @good() nounwind {
13 entry:
14   %x0 = alloca %struct.anon, align 4              ; <%struct.anon*> [#uses=2]
15   %tmp = bitcast %struct.anon* %x0 to i8*         ; <i8*> [#uses=1]
16   call void @llvm.memset.p0i8.i32(i8* %tmp, i8 0, i32 4, i1 false)
17   %tmp1 = bitcast %struct.anon* %x0 to i8*        ; <i8*> [#uses=1]
18   call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 1 getelementptr inbounds (%0, %0* @c, i32
19 0, i32 0, i32 0, i32 0), i8* %tmp1, i32 4, i32 4, i1 false)
20   ret void
21   
22 ; CHECK: store i8 0, i8*{{.*}}, align 4
23 ; CHECK: store i8 0, i8*{{.*}}, align 1
24 ; CHECK: store i8 0, i8*{{.*}}, align 2
25 ; CHECK: store i8 0, i8*{{.*}}, align 1
26 }
27
28 declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i1) nounwind
29
30 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32,
31 i1) nounwind
32