From 26c1bae3de5daa2ea28d7ee7584b98723f38c3fa Mon Sep 17 00:00:00 2001 From: Mark Seaborn Date: Mon, 24 Jun 2013 18:41:45 -0700 Subject: PNaCl ABI: Strip alignment info from memcpy/memmove/memset intrinsic calls Do the same for memcpy/memmove/memset intrinsic calls that we have already done for integer loads and stores: Remove assumptions about pointer alignment by setting the alignment argument to 1. Make the ABI checker require this. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3445 TEST=*.ll tests + PNaCl toolchain trybots Review URL: https://codereview.chromium.org/17563008 --- test/Transforms/NaCl/strip-attributes.ll | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/Transforms') diff --git a/test/Transforms/NaCl/strip-attributes.ll b/test/Transforms/NaCl/strip-attributes.ll index e8960d0f71..66224a8977 100644 --- a/test/Transforms/NaCl/strip-attributes.ll +++ b/test/Transforms/NaCl/strip-attributes.ll @@ -100,3 +100,21 @@ define void @reduce_alignment_assumptions() { ; CHECK-NEXT: load atomic i32* null seq_cst, align 4 ; CHECK-NEXT: store atomic i32 100, i32* null seq_cst, align 4 ; CHECK-NEXT: store atomic i32 100, i32* null seq_cst, align 4 + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) +declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) +declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) + +define void @reduce_memcpy_alignment_assumptions(i8* %ptr) { + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %ptr, i8* %ptr, + i32 20, i32 4, i1 false) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %ptr, i8* %ptr, + i32 20, i32 4, i1 false) + call void @llvm.memset.p0i8.i32(i8* %ptr, i8 99, + i32 20, i32 4, i1 false) + ret void +} +; CHECK: define void @reduce_memcpy_alignment_assumptions +; CHECK-NEXT: call void @llvm.memcpy.{{.*}} i32 20, i32 1, i1 false) +; CHECK-NEXT: call void @llvm.memmove.{{.*}} i32 20, i32 1, i1 false) +; CHECK-NEXT: call void @llvm.memset.{{.*}} i32 20, i32 1, i1 false) -- cgit v1.2.3-18-g5258