Teach the integer-promotion rewrite strategy to be endianness aware.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 4 Oct 2012 10:39:28 +0000 (10:39 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 4 Oct 2012 10:39:28 +0000 (10:39 +0000)
commit43c8b46deb9ca25797b1a8525067e1b6bd551979
tree2020089688e91331d3b61c78db6affbf4a84591d
parentb96a7b5aa58493480358e29e12ebdd0d342bd30e
Teach the integer-promotion rewrite strategy to be endianness aware.
Sorry for this being broken so long. =/

As part of this, switch all of the existing tests to be Little Endian,
which is the behavior I was asserting in them anyways! Add in a new
big-endian test that checks the interesting behavior there.

Another part of this is to tighten the rules abotu when we perform the
full-integer promotion. This logic now rejects cases where there fully
promoted integer is a non-multiple-of-8 bitwidth or cases where the
loads or stores touch bits which are in the allocated space of the
alloca but are not loaded or stored when accessing the integer. Sadly,
these aren't really observable today as the rest of the pass will
already ensure the invariants hold. However, the latter situation is
likely to become a potential concern in the future.

Thanks to Benjamin and Duncan for early review of this patch. I'm still
looking into whether there are further endianness issues, please let me
know if anyone sees BE failures persisting past this.

llvm-svn: 165219
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/Transforms/SROA/alignment.ll
llvm/test/Transforms/SROA/basictest.ll
llvm/test/Transforms/SROA/big-endian.ll [new file with mode: 0644]
llvm/test/Transforms/SROA/fca.ll
llvm/test/Transforms/SROA/phi-and-select.ll
llvm/test/Transforms/SROA/vector-promotion.ll