Fix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 10 Dec 2012 00:54:45 +0000 (00:54 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 10 Dec 2012 00:54:45 +0000 (00:54 +0000)
commit3d9afa8e9714fb4d0fd0d210a35dcffbc6e33742
tree648edc4dc60656fec7603ddc70174f93dcf0b241
parente17d858da81b11265224cd8d52ace250aaec1692
Fix PR14548: SROA was crashing on a mixture of i1 and i8 loads and stores.

When SROA was evaluating a mixture of i1 and i8 loads and stores, in
just a particular case, it would tickle a latent bug where we compared
bits to bytes rather than bits to bits. As a consequence of the latent
bug, we would allow integers through which were not byte-size multiples,
a situation the later rewriting code was never intended to handle.

In release builds this could trigger all manner of oddities, but the
reported issue in PR14548 was forming invalid bitcast instructions.

The only downside of this fix is that it makes it more clear that SROA
in its current form is not capable of handling mixed i1 and i8 loads and
stores. Sometimes with the previous code this would work by luck, but
usually it would crash, so I'm not terribly worried. I'll watch the LNT
numbers just to be sure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169719 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/basictest.ll
test/Transforms/SROA/big-endian.ll