SROA: Handle a case of store size being smaller than allocation size
authorReid Kleckner <reid@kleckner.net>
Fri, 22 Aug 2014 00:09:56 +0000 (00:09 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 22 Aug 2014 00:09:56 +0000 (00:09 +0000)
commit2c0e02e21bd99a4467576d39adcba76fc417b384
tree9753f883537581f66be2e987e4274fa1ffb4c7c2
parent5e83e81ab2aa47894843fed66edfd08e1d8e15af
SROA: Handle a case of store size being smaller than allocation size

In this case, we are creating an x86_fp80 slice for a union from C where
the padding bytes may contain real data. An x86_fp80 alloca is 16 bytes,
and that's just fine. We can't, however, use regular loads and stores to
access the slice, because the store size is only 10 bytes / 80 bits.
Instead, use memcpy and memset.

Fixes PR18726.

Reviewed By: chandlerc

Differential Revision: http://reviews.llvm.org/D5012

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