summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-09-25 15:30:47 +0000
committerNirav Dave <niravd@google.com>2018-09-25 15:30:47 +0000
commit0a0c2e6dd9a363750b0b965476eae81abf7c9c9c (patch)
tree02fc8170942ccbaf89101496c363dfe46c6d4652
parente40e2bbd3710a4a8016c76b55d675b6e4ebb5458 (diff)
downloadbcm5719-llvm-0a0c2e6dd9a363750b0b965476eae81abf7c9c9c.tar.gz
bcm5719-llvm-0a0c2e6dd9a363750b0b965476eae81abf7c9c9c.zip
[ARM] Share predecessor bookkeeping in CombineBaseUpdate. NFCI.
llvm-svn: 342987
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 70446de9a12..16111557650 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -11606,8 +11606,15 @@ static SDValue CombineBaseUpdate(SDNode *N,
continue;
// Check that the add is independent of the load/store. Otherwise, folding
- // it would create a cycle.
- if (User->isPredecessorOf(N) || N->isPredecessorOf(User))
+ // it would create a cycle. We can avoid searching through Addr as it's a
+ // predecessor to both.
+ SmallPtrSet<const SDNode *, 32> Visited;
+ SmallVector<const SDNode *, 16> Worklist;
+ Visited.insert(Addr.getNode());
+ Worklist.push_back(N);
+ Worklist.push_back(User);
+ if (SDNode::hasPredecessorHelper(N, Visited, Worklist) ||
+ SDNode::hasPredecessorHelper(User, Visited, Worklist))
continue;
// Find the new opcode for the updating load/store.
OpenPOWER on IntegriCloud