summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2014-03-26 23:45:15 +0000
committerNick Lewycky <nicholas@mxc.ca>2014-03-26 23:45:15 +0000
commit77d5fb40c8f71a5bef45e7ad8aeb8a444a6e3df4 (patch)
tree56566888a6737d8ba814daad1bd54f0da687d0a9 /llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
parent7790cf88e0119f3c16062700587d9589c57f10a1 (diff)
downloadbcm5719-llvm-77d5fb40c8f71a5bef45e7ad8aeb8a444a6e3df4.tar.gz
bcm5719-llvm-77d5fb40c8f71a5bef45e7ad8aeb8a444a6e3df4.zip
Treat lifetime.start'd memory like we treat freshly alloca'd memory. Patch by Björn Steinbrink!
llvm-svn: 204876
Diffstat (limited to 'llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll')
-rw-r--r--llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll b/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
index fd4965f4dc5..663b8dcfd3d 100644
--- a/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
+++ b/llvm/test/Transforms/MemCpyOpt/memcpy-undef.ll
@@ -21,5 +21,26 @@ define i32 @test1(%struct.foo* nocapture %foobie) nounwind noinline ssp uwtable
; CHECK-NOT: call void @llvm.memcpy
}
+define void @test2(i8* sret noalias nocapture %out, i8* %in) nounwind noinline ssp uwtable {
+ call void @llvm.lifetime.start(i64 8, i8* %in)
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 8, i32 1, i1 false)
+ ret void
+
+; Check that the memcpy is removed.
+; CHECK-LABEL: @test2(
+; CHECK-NOT: call void @llvm.memcpy
+}
+
+define void @test3(i8* sret noalias nocapture %out, i8* %in) nounwind noinline ssp uwtable {
+ call void @llvm.lifetime.start(i64 4, i8* %in)
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %out, i8* %in, i64 8, i32 1, i1 false)
+ ret void
+
+; Check that the memcpy is not removed.
+; CHECK-LABEL: @test3(
+; CHECK: call void @llvm.memcpy
+}
+
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
+declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind
OpenPOWER on IntegriCloud