aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/DeadStoreElimination/memintrinsics.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-11-07 08:34:40 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-11-07 08:34:40 +0000
commit4de9b7f51f81acbc36e9fd17042b14bb40149c6c (patch)
treead403238bcef6b01c5b99f0947ebee841cbbbc50 /test/Transforms/DeadStoreElimination/memintrinsics.ll
parent60a0063d2acab0b8f5bdc6c469037744d482a613 (diff)
Teach dead store elimination that certain intrinsics write to memory just like
a store. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/DeadStoreElimination/memintrinsics.ll')
-rw-r--r--test/Transforms/DeadStoreElimination/memintrinsics.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/Transforms/DeadStoreElimination/memintrinsics.ll b/test/Transforms/DeadStoreElimination/memintrinsics.ll
new file mode 100644
index 0000000000..e31e9fa3ca
--- /dev/null
+++ b/test/Transforms/DeadStoreElimination/memintrinsics.ll
@@ -0,0 +1,47 @@
+; RUN: opt -S -dse < %s | FileCheck %s
+
+declare void @llvm.memcpy.i8(i8*, i8*, i8, i32)
+declare void @llvm.memmove.i8(i8*, i8*, i8, i32)
+declare void @llvm.memset.i8(i8*, i8, i8, i32)
+
+define void @test1() {
+; CHECK: @test1
+ %A = alloca i8
+ %B = alloca i8
+
+ store i8 0, i8* %A ;; Written to by memcpy
+; CHECK-NOT: store
+
+ call void @llvm.memcpy.i8(i8* %A, i8* %B, i8 -1, i32 0)
+
+ ret void
+; CHECK: ret void
+}
+
+define void @test2() {
+; CHECK: @test2
+ %A = alloca i8
+ %B = alloca i8
+
+ store i8 0, i8* %A ;; Written to by memmove
+; CHECK-NOT: store
+
+ call void @llvm.memmove.i8(i8* %A, i8* %B, i8 -1, i32 0)
+
+ ret void
+; CHECK: ret void
+}
+
+define void @test3() {
+; CHECK: @test3
+ %A = alloca i8
+ %B = alloca i8
+
+ store i8 0, i8* %A ;; Written to by memset
+; CHECK-NOT: store
+
+ call void @llvm.memset.i8(i8* %A, i8 0, i8 -1, i32 0)
+
+ ret void
+; CHECK: ret void
+}