aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-18 06:41:51 +0000
committerChris Lattner <sabre@nondot.org>2010-11-18 06:41:51 +0000
commit6248065194778c866164b0c10f09f0f0d91b91ac (patch)
treeeec283653b335667e90bc163995d1d3b7339829f /test
parenta9be1df6d7a9b5a07253d83a634ae5876e7e5550 (diff)
downloadexternal_llvm-6248065194778c866164b0c10f09f0f0d91b91ac.zip
external_llvm-6248065194778c866164b0c10f09f0f0d91b91ac.tar.gz
external_llvm-6248065194778c866164b0c10f09f0f0d91b91ac.tar.bz2
allow eliminating an alloca that is just copied from an constant global
if it is passed as a byval argument. The byval argument will just be a read, so it is safe to read from the original global instead. This allows us to promote away the %agg.tmp alloca in PR8582 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/ScalarRepl/memcpy-from-global.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Transforms/ScalarRepl/memcpy-from-global.ll b/test/Transforms/ScalarRepl/memcpy-from-global.ll
index 68fc2a2..5b25864 100644
--- a/test/Transforms/ScalarRepl/memcpy-from-global.ll
+++ b/test/Transforms/ScalarRepl/memcpy-from-global.ll
@@ -81,3 +81,16 @@ define void @test3() {
; CHECK-NEXT: call void @bar(i8* %a)
ret void
}
+
+define void @test4() {
+ %A = alloca %T
+ %a = bitcast %T* %A to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false)
+ call void @baz(i8* byval %a)
+; CHECK: @test4
+; CHECK-NEXT: %a = bitcast %T* @G to i8*
+; CHECK-NEXT: call void @baz(i8* byval %a)
+ ret void
+}
+
+declare void @baz(i8* byval)