[SelectionDAG] More Aggressibly prune nodes in AddChains. NFCI.

Travel all chains paths to first non-tokenfactor node can be
exponential work. Add simple redundency check to avoid this.
Fixes PR36264.

llvm-svn: 324491
This commit is contained in:
Nirav Dave 2018-02-07 17:12:34 +00:00
parent d7e17c232f
commit efed656873

View File

@ -2396,13 +2396,15 @@ HandleMergeInputChains(SmallVectorImpl<SDNode*> &ChainNodesMatched,
return;
if (V->getOpcode() == ISD::EntryToken)
return;
if (!Visited.insert(V.getNode()).second)
return;
// Newly selected nodes (-1) are always added directly.
if (V->getNodeId() == -1)
InputChains.push_back(V);
else if (V->getOpcode() == ISD::TokenFactor) {
for (int i = 0, e = V->getNumOperands(); i != e; ++i)
AddChains(V->getOperand(i));
} else if (!Visited.count(V.getNode()))
} else
InputChains.push_back(V);
};