summaryrefslogtreecommitdiff
path: root/test/Transforms/ScalarRepl/copy-aggregate.ll
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2011-01-13 17:45:11 +0000
committerBob Wilson <bob.wilson@apple.com>2011-01-13 17:45:11 +0000
commit704d1347c5009f674408fae6f78343b415891274 (patch)
treee217edf15c674d9db8bdc61394344f35f3e3957f /test/Transforms/ScalarRepl/copy-aggregate.ll
parent694a10e7d8410f24639971224ce0e282c8cd04cb (diff)
downloadllvm-704d1347c5009f674408fae6f78343b415891274.tar.gz
llvm-704d1347c5009f674408fae6f78343b415891274.tar.bz2
llvm-704d1347c5009f674408fae6f78343b415891274.tar.xz
Extend SROA to handle arrays accessed as homogeneous structs and vice versa.
This is a minor extension of SROA to handle a special case that is important for some ARM NEON operations. Some of the NEON intrinsics return multiple values, which are handled as struct types containing multiple elements of the same vector type. The corresponding return types declared in the arm_neon.h header have equivalent arrays. We need SROA to recognize that it can split up those arrays and structs into separate vectors, even though they are not always accessed with the same type. SROA already handles loads and stores of an entire alloca by using insertvalue/extractvalue to access the individual pieces, and that code works the same regardless of whether the type is a struct or an array. So, all that needs to be done is to check for compatible arrays and homogeneous structs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123381 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ScalarRepl/copy-aggregate.ll')
-rw-r--r--test/Transforms/ScalarRepl/copy-aggregate.ll29
1 files changed, 26 insertions, 3 deletions
diff --git a/test/Transforms/ScalarRepl/copy-aggregate.ll b/test/Transforms/ScalarRepl/copy-aggregate.ll
index 6e01aa3c51..997da4bdb2 100644
--- a/test/Transforms/ScalarRepl/copy-aggregate.ll
+++ b/test/Transforms/ScalarRepl/copy-aggregate.ll
@@ -76,10 +76,33 @@ entry:
%var = alloca %arr, align 4
%vari8 = bitcast %arr* %var to i8*
%pi8 = bitcast %arr* %p to i8*
- call void @llvm.memcpy.i32(i8* %vari8, i8* %pi8, i32 16, i32 4)
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %vari8, i8* %pi8, i32 16, i32 4, i1 false)
%qi8 = bitcast %arr* %q to i8*
- call void @llvm.memcpy.i32(i8* %qi8, i8* %vari8, i32 16, i32 4)
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %qi8, i8* %vari8, i32 16, i32 4, i1 false)
ret void
}
-declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind
+;; Check that an array alloca can be split up when it is also accessed with
+;; a load or store as a homogeneous structure with the same element type and
+;; number of elements as the array.
+%homogeneous = type { <8 x i16>, <8 x i16>, <8 x i16> }
+%wrapped_array = type { [3 x <8 x i16>] }
+define void @test6(i8* %p, %wrapped_array* %arr) {
+entry:
+; CHECK: test6
+; CHECK: store <8 x i16>
+; CHECK: store <8 x i16>
+; CHECK: store <8 x i16>
+ %var = alloca %wrapped_array, align 16
+ %res = call %homogeneous @test6callee(i8* %p)
+ %varcast = bitcast %wrapped_array* %var to %homogeneous*
+ store %homogeneous %res, %homogeneous* %varcast
+ %tmp1 = bitcast %wrapped_array* %arr to i8*
+ %tmp2 = bitcast %wrapped_array* %var to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp1, i8* %tmp2, i32 48, i32 16, i1 false)
+ ret void
+}
+
+declare %homogeneous @test6callee(i8* nocapture) nounwind
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind