1 ; RUN: opt -passes=lint -disable-output < %s 2>&1 | FileCheck %s
3 declare void @llvm.memcpy.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1) nounwind argmemonly
5 define void @f_memcpy() {
7 %dst = alloca [1000 x i8], align 2
8 %src = alloca [1000 x i8], align 4
9 ; CHECK: Undefined behavior: Memory reference address is misaligned
10 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 8 %dst, ptr align 4 %src, i32 200, i1 false)
11 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %dst, ptr align 4 %src, i32 200, i1 false)
12 ; CHECK: Undefined behavior: Memory reference address is misaligned
13 ; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 2 %dst, ptr align 8 %src, i32 200, i1 false)
14 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %dst, ptr align 8 %src, i32 200, i1 false)
15 ; CHECK-NOT: @llvm.memcpy.p0.p0.i32
16 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %dst, ptr align 4 %src, i32 200, i1 false)
17 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %dst, ptr align 2 %src, i32 200, i1 false)
18 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %dst, ptr align 4 %src, i32 200, i1 false)
23 declare void @llvm.memmove.p0.p0.i32(ptr nocapture writeonly, ptr nocapture readonly, i32, i1) nounwind argmemonly
25 define void @f_memmove() {
27 %dst = alloca [1000 x i8], align 2
28 %src = alloca [1000 x i8], align 4
29 ; CHECK: Undefined behavior: Memory reference address is misaligned
30 ; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr align 4 %dst, ptr align 4 %src, i32 200, i1 false)
31 call void @llvm.memmove.p0.p0.i32(ptr align 4 %dst, ptr align 4 %src, i32 200, i1 false)
32 ; CHECK: Undefined behavior: Memory reference address is misaligned
33 ; CHECK-NEXT: call void @llvm.memmove.p0.p0.i32(ptr align 2 %dst, ptr align 8 %src, i32 200, i1 false)
34 call void @llvm.memmove.p0.p0.i32(ptr align 2 %dst, ptr align 8 %src, i32 200, i1 false)
35 ; CHECK-NOT: @llvm.memmove.p0.p0.i32
36 call void @llvm.memmove.p0.p0.i32(ptr align 1 %dst, ptr align 4 %src, i32 200, i1 false)
37 call void @llvm.memmove.p0.p0.i32(ptr align 2 %dst, ptr align 2 %src, i32 200, i1 false)
38 call void @llvm.memmove.p0.p0.i32(ptr align 2 %dst, ptr align 4 %src, i32 200, i1 false)
43 declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1) nounwind argmemonly
45 define void @f_memset() {
47 %dst = alloca [1000 x i8], align 2
48 ; CHECK: Undefined behavior: Memory reference address is misaligned
49 ; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr align 4 %dst, i8 55, i32 200, i1 false)
50 call void @llvm.memset.p0.i32(ptr align 4 %dst, i8 55, i32 200, i1 false)
51 ; CHECK-NOT: @llvm.memset.p0.i32
52 call void @llvm.memset.p0.i32(ptr align 1 %dst, i8 55, i32 200, i1 false)
53 call void @llvm.memset.p0.i32(ptr align 2 %dst, i8 55, i32 200, i1 false)