summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorSam Parker <sam.parker@arm.com>2019-01-23 09:11:49 +0000
committerSam Parker <sam.parker@arm.com>2019-01-23 09:11:49 +0000
commit9a2a89d58f211126aef9206b246f089e8d19db15 (patch)
treed63d76a2094d64a6bf3a29e906962bfc2b1e6dd4 /llvm/lib/CodeGen
parente70ba0a1bc301a39495112fb7ed5ca895542f673 (diff)
downloadbcm5719-llvm-9a2a89d58f211126aef9206b246f089e8d19db15.tar.gz
bcm5719-llvm-9a2a89d58f211126aef9206b246f089e8d19db15.zip
[DAGCombine] Enable more pre-indexed stores
The current check in CombineToPreIndexedLoadStore is too conversative, preventing a pre-indexed store when the base pointer is a predecessor of the value being stored. Instead, we should check the pointer operand of the store. Differential Revision: https://reviews.llvm.org/D56719 llvm-svn: 351933
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index b440bbe29fd..97b21e108ea 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -12652,7 +12652,13 @@ bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) {
// Check #2.
if (!isLoad) {
SDValue Val = cast<StoreSDNode>(N)->getValue();
- if (Val == BasePtr || BasePtr.getNode()->isPredecessorOf(Val.getNode()))
+
+ // Would require a copy.
+ if (Val == BasePtr)
+ return false;
+
+ // Would create a cycle.
+ if (Val == Ptr || Ptr->isPredecessorOf(Val.getNode()))
return false;
}
OpenPOWER on IntegriCloud