Extend SROA to handle arrays accessed as homogeneous structs and vice versa.
authorBob Wilson <bob.wilson@apple.com>
Thu, 13 Jan 2011 17:45:11 +0000 (17:45 +0000)
committerBob Wilson <bob.wilson@apple.com>
Thu, 13 Jan 2011 17:45:11 +0000 (17:45 +0000)
commit704d1347c5009f674408fae6f78343b415891274
treee217edf15c674d9db8bdc61394344f35f3e3957f
parent694a10e7d8410f24639971224ce0e282c8cd04cb
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
lib/Transforms/Scalar/ScalarReplAggregates.cpp
test/Transforms/ScalarRepl/copy-aggregate.ll