[ARM] Share predecessor bookkeeping in CombineBaseUpdate. NFCI.

llvm-svn: 342987
This commit is contained in:
Nirav Dave 2018-09-25 15:30:47 +00:00
parent e40e2bbd37
commit 0a0c2e6dd9
1 changed files with 9 additions and 2 deletions

View File

@ -11606,8 +11606,15 @@ static SDValue CombineBaseUpdate(SDNode *N,
continue; continue;
// Check that the add is independent of the load/store. Otherwise, folding // Check that the add is independent of the load/store. Otherwise, folding
// it would create a cycle. // it would create a cycle. We can avoid searching through Addr as it's a
if (User->isPredecessorOf(N) || N->isPredecessorOf(User)) // 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; continue;
// Find the new opcode for the updating load/store. // Find the new opcode for the updating load/store.