diff options
author | Evan Cheng <evan.cheng@apple.com> | 2007-03-24 00:02:43 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2007-03-24 00:02:43 +0000 |
commit | b7051f596a1f04095117f410e12e7e326bf47eaa (patch) | |
tree | edf31ad160f9c71649d228b17433366b9b453ae1 /llvm/lib/CodeGen | |
parent | 8aae2d7e1ce024c96c2c0ca16c29629703c3c1c3 (diff) | |
download | bcm5719-llvm-b7051f596a1f04095117f410e12e7e326bf47eaa.tar.gz bcm5719-llvm-b7051f596a1f04095117f410e12e7e326bf47eaa.zip |
Adjust offset to compensate for big endian machines.
llvm-svn: 35293
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 569b1a91d71..6187aba6405 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2292,7 +2292,6 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) { N0 = N0.getOperand(0); if (MVT::getSizeInBits(N0.getValueType()) <= EVTBits) return SDOperand(); - ShAmt /= 8; CombineSRL = true; } } @@ -2308,12 +2307,11 @@ SDOperand DAGCombiner::ReduceLoadWidth(SDNode *N) { "Cannot truncate to larger type!"); LoadSDNode *LN0 = cast<LoadSDNode>(N0); MVT::ValueType PtrType = N0.getOperand(1).getValueType(); - // For big endian targets, we need to add an offset to the pointer to load - // the correct bytes. For little endian systems, we merely need to read - // fewer bytes from the same pointer. - uint64_t PtrOff = ShAmt - ? ShAmt : (TLI.isLittleEndian() ? 0 - : (MVT::getSizeInBits(N0.getValueType()) - EVTBits) / 8); + // For big endian targets, we need to adjust the offset to the pointer to + // load the correct bytes. + if (!TLI.isLittleEndian()) + ShAmt = MVT::getSizeInBits(N0.getValueType()) - ShAmt - EVTBits; + uint64_t PtrOff = ShAmt / 8; SDOperand NewPtr = DAG.getNode(ISD::ADD, PtrType, LN0->getBasePtr(), DAG.getConstant(PtrOff, PtrType)); AddToWorkList(NewPtr.Val); |