llvm/lib/Transforms
Ulrich Weigand d04d5a974e [GVN] Fix handling of sub-byte types in big-endian mode
When GVN wants to re-interpret an already available value in a smaller
type, it needs to right-shift the value on big-endian systems to ensure
the correct bytes are accessed.  The shift value is the difference of
the sizes of the two types.

This is correct as long as both types occupy multiples of full bytes.
However, when one of them is a sub-byte type like i1, this no longer
holds true: we still need to shift, but only to access the correct
*byte*.  Accessing bits within the byte requires no shift in either
endianness; e.g. an i1 resides in the least-significant bit of its
containing byte on both big- and little-endian systems.

Therefore, the appropriate shift value to be used is the difference of
the *storage* sizes of the two types.  This is already handled correctly
in one place where such a shift takes place (GetStoreValueForLoad), but
is incorrect in two other places: GetLoadValueForLoad and
CoerceAvailableValueToLoadType.

This patch changes both places to use the storage size as well.

Differential Revision: http://reviews.llvm.org/D18662



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265684 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 15:45:02 +00:00
..
Hello
InstCombine [InstCombine] Don't sink an instr after a catchswitch 2016-04-01 17:28:17 +00:00
Instrumentation Make helper functions static. NFC. 2016-04-07 10:10:09 +00:00
IPO NFC: make AtomicOrdering an enum class 2016-04-06 21:19:33 +00:00
ObjCARC ADT: Remove == and != comparisons between ilist iterators and pointers 2016-02-21 20:39:50 +00:00
Scalar [GVN] Fix handling of sub-byte types in big-endian mode 2016-04-07 15:45:02 +00:00
Utils Revert "ValueMapper: Make LocalAsMetadata match function-local Values" 2016-04-07 02:10:50 +00:00
Vectorize Revert r265535 until we know how we can fix the bots 2016-04-06 14:06:32 +00:00
CMakeLists.txt
LLVMBuild.txt