diff options
| author | Nirav Dave <niravd@google.com> | 2018-10-11 18:28:59 +0000 |
|---|---|---|
| committer | Nirav Dave <niravd@google.com> | 2018-10-11 18:28:59 +0000 |
| commit | f1f2a2a31ad6200f468718dbbc75fbfbea152915 (patch) | |
| tree | 701149a189faff780647fb2235db0f5572ce8926 /llvm/lib | |
| parent | 5d3a6f76a8d642e81399e64606152d9f34d6e751 (diff) | |
| download | bcm5719-llvm-f1f2a2a31ad6200f468718dbbc75fbfbea152915.tar.gz bcm5719-llvm-f1f2a2a31ad6200f468718dbbc75fbfbea152915.zip | |
[DAG] Fix Big Endian in Load-Store forwarding
Summary:
Correct offset calculation in load-store forwarding for big-endian
targets.
Reviewers: rnk, RKSimon, waltl
Subscribers: sdardis, nemanjai, hiraditya, jrtc27, atanasyan, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D53147
llvm-svn: 344272
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 4a80c1d358d..16834dc1a26 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -12847,6 +12847,11 @@ SDValue DAGCombiner::ForwardStoreValueToDirectLoad(LoadSDNode *LD) { if (!STCoversLD) return SDValue(); + // Normalize for Endianness. + if (DAG.getDataLayout().isBigEndian()) + Offset = + (STMemType.getSizeInBits() - LDMemType.getSizeInBits()) / 8 - Offset; + // Memory as copy space (potentially masked). if (Offset == 0 && LDType == STType && STMemType == LDMemType) { // Simple case: Direct non-truncating forwarding |

