summaryrefslogtreecommitdiff
path: root/test/Transforms/ScalarRepl
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-08 05:42:05 +0000
committerChris Lattner <sabre@nondot.org>2009-01-08 05:42:05 +0000
commit5ffe6acd577696a41932c7b82db06a04687e07ba (patch)
tree0428339c472fbe19d2ccacd0e1f05aa369a341d9 /test/Transforms/ScalarRepl
parent8bb5e9901346f448461289f2d0079ed6d534b571 (diff)
downloadllvm-5ffe6acd577696a41932c7b82db06a04687e07ba.tar.gz
llvm-5ffe6acd577696a41932c7b82db06a04687e07ba.tar.bz2
llvm-5ffe6acd577696a41932c7b82db06a04687e07ba.tar.xz
This implements the second half of the fix for PR3290, handling
loads from allocas that cover the entire aggregate. This handles some memcpy/byval cases that are produced by llvm-gcc. This triggers a few times in kc++ (with std::pair<std::_Rb_tree_const_iterator <kc::impl_abstract_phylum*>,bool>) and once in 176.gcc (with %struct..0anon). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ScalarRepl')
-rw-r--r--test/Transforms/ScalarRepl/copy-aggregate.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Transforms/ScalarRepl/copy-aggregate.ll b/test/Transforms/ScalarRepl/copy-aggregate.ll
index c3685d0930..4ab17ae2bb 100644
--- a/test/Transforms/ScalarRepl/copy-aggregate.ll
+++ b/test/Transforms/ScalarRepl/copy-aggregate.ll
@@ -29,3 +29,29 @@ define float @test2(i128 %V) nounwind {
ret float %c
}
+;; Load of whole alloca struct as integer
+define i64 @test3(i32 %a, i32 %b) nounwind {
+ %X = alloca {{i32, i32}}
+
+ %A = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 0
+ %B = getelementptr {{i32,i32}}* %X, i32 0, i32 0, i32 1
+ store i32 %a, i32* %A
+ store i32 %b, i32* %B
+
+ %Y = bitcast {{i32,i32}}* %X to i64*
+ %Z = load i64* %Y
+ ret i64 %Z
+}
+
+;; load of integer from whole struct/array alloca.
+define i128 @test4(float %a, float %b) nounwind {
+ %X = alloca {[4 x float]}
+ %A = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 0
+ %B = getelementptr {[4 x float]}* %X, i32 0, i32 0, i32 3
+ store float %a, float* %A
+ store float %b, float* %B
+
+ %Y = bitcast {[4 x float]}* %X to i128*
+ %V = load i128* %Y
+ ret i128 %V
+}