Make InstCombineCasts.cpp:OptimizeIntToFloatBitCast endian safe.
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Tue, 26 Mar 2013 15:36:14 +0000 (15:36 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Tue, 26 Mar 2013 15:36:14 +0000 (15:36 +0000)
commit8a51d8ea95b0fe1362abd3e276cdb4f2d06678da
treed0833e81e258bf1d2292dede6d2f4d83e473e9d9
parentf299668aeb9cfcbae97b2054b8d18b7060651b80
Make InstCombineCasts.cpp:OptimizeIntToFloatBitCast endian safe.

The OptimizeIntToFloatBitCast converts shift-truncate sequences
into extractelement operations.  The computation of the element
index to be used in the resulting operation is currently only
correct for little-endian targets.

This commit fixes the element index computation to be correct
for big-endian targets as well.  If the target byte order is
unknown, the optimization cannot be performed at all.

llvm-svn: 178031
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp