Fix SROA to avoid unnecessary scalar conversions for 1-element vectors.
authorBob Wilson <bob.wilson@apple.com>
Tue, 25 Jun 2013 19:09:50 +0000 (19:09 +0000)
committerBob Wilson <bob.wilson@apple.com>
Tue, 25 Jun 2013 19:09:50 +0000 (19:09 +0000)
commita1fe2948ed4039e68d1784494c3b23a4ce4126b4
tree4a63fabad494aa789ebf7c51c28166308920a07a
parent2560e242c87b205143ca5e0e87a216e06f51a434
Fix SROA to avoid unnecessary scalar conversions for 1-element vectors.

When a 1-element vector alloca is promoted, a store instruction can often be
rewritten without converting the value to a scalar and using an insertelement
instruction to stuff it into the new alloca.  This patch just adds a check
to skip that conversion when it is unnecessary.  This turns out to be really
important for some ARM Neon operations where <1 x i64> is used to get around
the fact that i64 is not a legal type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184870 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp
test/Transforms/ScalarRepl/vector_promote.ll