SROA: Only split loads on byte boundaries
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 17 Jun 2014 00:19:35 +0000 (00:19 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 17 Jun 2014 00:19:35 +0000 (00:19 +0000)
commit73686d305a99750bb61202565b6bc73d74103bfb
treed8e19a26eb89ce892013aa9a36f47164113ade15
parent04c764f6d9ac2eb7263d84f842906adfb80d53b3
SROA: Only split loads on byte boundaries

r199771 accidently broke the logic that makes sure that SROA only splits
load on byte boundaries.  If such a split happens, some bits get lost
when reassembling loads of wider types, causing data corruption.

Move the width check up to reject such splits early, avoiding the
corruption.  Fixes PR19250.

Patch by: Björn Steinbrink <bsteinbr@gmail.com>

llvm-svn: 211082
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/Transforms/SROA/slice-order-independence.ll [new file with mode: 0644]
llvm/test/Transforms/SROA/slice-width.ll [new file with mode: 0644]