aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2016-04-07 15:45:02 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2016-04-07 15:45:02 +0000
commit6e6966460a387724cd87ec92d3a91ecfbee84a24 (patch)
treed2c3798e109ea82e8a9e66256c9d10899e2a8fc1 /clang/lib/CodeGen/ModuleBuilder.cpp
parent4701a91e59270639341fde8f34eaf2773e1c74c6 (diff)
downloadllvm-6e6966460a387724cd87ec92d3a91ecfbee84a24.zip
llvm-6e6966460a387724cd87ec92d3a91ecfbee84a24.tar.gz
llvm-6e6966460a387724cd87ec92d3a91ecfbee84a24.tar.bz2
[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 llvm-svn: 265684
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
0 files changed, 0 insertions, 0 deletions