aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-03-13 08:36:20 +0000
committerJonas Paulsson <paulsson@linux.vnet.ibm.com>2018-03-13 08:36:20 +0000
commit5612bb292c861f41c71abf2cb3e48fff93a3f34f (patch)
tree2b55c35661b2d4899154c2d6eed735bec97694f4 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parentafbf90aef9e7878a2b139c3f7a5ef22b5d34caf7 (diff)
downloadllvm-5612bb292c861f41c71abf2cb3e48fff93a3f34f.zip
llvm-5612bb292c861f41c71abf2cb3e48fff93a3f34f.tar.gz
llvm-5612bb292c861f41c71abf2cb3e48fff93a3f34f.tar.bz2
[CodeGenPrepare] Respect endianness in splitMergedValStore.
splitMergedValStore will split a store into two if target prefers this, or if -force-split-store is passed. This patch adds the missing handling for endianness in this function along with a test case. Review: Eli Friedman https://reviews.llvm.org/D44396 llvm-svn: 327375
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 422a0a9..b8922bd 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -5999,12 +5999,13 @@ static bool splitMergedValStore(StoreInst &SI, const DataLayout &DL,
if (HBC && HBC->getParent() != SI.getParent())
HValue = Builder.CreateBitCast(HBC->getOperand(0), HBC->getType());
+ bool IsLE = SI.getModule()->getDataLayout().isLittleEndian();
auto CreateSplitStore = [&](Value *V, bool Upper) {
V = Builder.CreateZExtOrBitCast(V, SplitStoreType);
Value *Addr = Builder.CreateBitCast(
SI.getOperand(1),
SplitStoreType->getPointerTo(SI.getPointerAddressSpace()));
- if (Upper)
+ if ((IsLE && Upper) || (!IsLE && !Upper))
Addr = Builder.CreateGEP(
SplitStoreType, Addr,
ConstantInt::get(Type::getInt32Ty(SI.getContext()), 1));