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)
commit0dee67560f17e43d32d52224c7f817226d75c646
treea0639fe3ed308e0a304ab17a74e1eeeb3fe81bd3
parent84fea7720cf37d82af2968e073cff71305f130e7
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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211082 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/slice-order-independence.ll [new file with mode: 0644]
test/Transforms/SROA/slice-width.ll [new file with mode: 0644]