X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=test%2FTransforms%2FMemCpyOpt%2Fmemcpy-undef.ll;h=9d8db7e07dc98caace9eae084256e465324a955c;hp=fd4965f4dc5bc27c79e0b7a45292e86ac10d93a1;hb=8b170f7f290843dc3849eaa75b6f74a87a7a2de6;hpb=44e40408eebdd38831501fc2fab59d550e951808 diff --git a/test/Transforms/MemCpyOpt/memcpy-undef.ll b/test/Transforms/MemCpyOpt/memcpy-undef.ll index fd4965f4dc5..9d8db7e07dc 100644 --- a/test/Transforms/MemCpyOpt/memcpy-undef.ll +++ b/test/Transforms/MemCpyOpt/memcpy-undef.ll @@ -7,12 +7,12 @@ target triple = "x86_64-apple-macosx10.8.0" define i32 @test1(%struct.foo* nocapture %foobie) nounwind noinline ssp uwtable { %bletch.sroa.1 = alloca [7 x i8], align 1 - %1 = getelementptr inbounds %struct.foo* %foobie, i64 0, i32 0 + %1 = getelementptr inbounds %struct.foo, %struct.foo* %foobie, i64 0, i32 0 store i8 98, i8* %1, align 4 - %2 = getelementptr inbounds %struct.foo* %foobie, i64 0, i32 1, i64 0 - %3 = getelementptr inbounds [7 x i8]* %bletch.sroa.1, i64 0, i64 0 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 7, i32 1, i1 false) - %4 = getelementptr inbounds %struct.foo* %foobie, i64 0, i32 2 + %2 = getelementptr inbounds %struct.foo, %struct.foo* %foobie, i64 0, i32 1, i64 0 + %3 = getelementptr inbounds [7 x i8], [7 x i8]* %bletch.sroa.1, i64 0, i64 0 + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 7, i1 false) + %4 = getelementptr inbounds %struct.foo, %struct.foo* %foobie, i64 0, i32 2 store i32 20, i32* %4, align 4 ret i32 undef @@ -21,5 +21,26 @@ define i32 @test1(%struct.foo* nocapture %foobie) nounwind noinline ssp uwtable ; CHECK-NOT: call void @llvm.memcpy } -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind +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, 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, 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, i1) nounwind + +declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind