[DAGCombine] Share predecessor bookkeeping in CombineToPostIndexedLoadStore. NFCI.

llvm-svn: 342983
This commit is contained in:
Nirav Dave 2018-09-25 15:29:04 +00:00
parent 345fae5d56
commit 7373d5e646
1 changed files with 9 additions and 2 deletions

View File

@ -12701,8 +12701,15 @@ bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) {
if (TryNext)
continue;
// Check for #2
if (!Op->isPredecessorOf(N) && !N->isPredecessorOf(Op)) {
// Check for #2.
SmallPtrSet<const SDNode *, 32> Visited;
SmallVector<const SDNode *, 8> Worklist;
// Ptr is predecessor to both N and Op.
Visited.insert(Ptr.getNode());
Worklist.push_back(N);
Worklist.push_back(Op);
if (!SDNode::hasPredecessorHelper(N, Visited, Worklist) &&
!SDNode::hasPredecessorHelper(Op, Visited, Worklist)) {
SDValue Result = isLoad
? DAG.getIndexedLoad(SDValue(N,0), SDLoc(N),
BasePtr, Offset, AM)