aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorMark Seaborn <mseaborn@chromium.org>2013-06-24 18:41:45 -0700
committerMark Seaborn <mseaborn@chromium.org>2013-06-24 18:41:45 -0700
commit26c1bae3de5daa2ea28d7ee7584b98723f38c3fa (patch)
treef14d2f14ce033175a22eb0bd4bdcb93b0c52bce1 /test/Transforms
parent9a2a4d5471baa159bfd4ed793962ec5d0841631b (diff)
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
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/NaCl/strip-attributes.ll18
1 files changed, 18 insertions, 0 deletions
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)