forked from OSchip/llvm-project
[DAGCombiner] Limit number of nodes explored as store candidates.
To find the candidates to merge stores we iterate over all nodes in a chain for each store, which leads to quadratic compile times for large basic blocks with a large number of stores. Reviewers: niravd, spatel, craig.topper Reviewed By: niravd Differential Revision: https://reviews.llvm.org/D61511 llvm-svn: 360357
This commit is contained in:
parent
0b68fc3f59
commit
be10bc71f9
|
@ -14857,9 +14857,11 @@ void DAGCombiner::getStoreMergeCandidates(
|
||||||
|
|
||||||
RootNode = St->getChain().getNode();
|
RootNode = St->getChain().getNode();
|
||||||
|
|
||||||
|
unsigned NumNodesExplored = 0;
|
||||||
if (LoadSDNode *Ldn = dyn_cast<LoadSDNode>(RootNode)) {
|
if (LoadSDNode *Ldn = dyn_cast<LoadSDNode>(RootNode)) {
|
||||||
RootNode = Ldn->getChain().getNode();
|
RootNode = Ldn->getChain().getNode();
|
||||||
for (auto I = RootNode->use_begin(), E = RootNode->use_end(); I != E; ++I)
|
for (auto I = RootNode->use_begin(), E = RootNode->use_end();
|
||||||
|
I != E && NumNodesExplored < 1024; ++I, ++NumNodesExplored)
|
||||||
if (I.getOperandNo() == 0 && isa<LoadSDNode>(*I)) // walk down chain
|
if (I.getOperandNo() == 0 && isa<LoadSDNode>(*I)) // walk down chain
|
||||||
for (auto I2 = (*I)->use_begin(), E2 = (*I)->use_end(); I2 != E2; ++I2)
|
for (auto I2 = (*I)->use_begin(), E2 = (*I)->use_end(); I2 != E2; ++I2)
|
||||||
if (I2.getOperandNo() == 0)
|
if (I2.getOperandNo() == 0)
|
||||||
|
@ -14870,7 +14872,8 @@ void DAGCombiner::getStoreMergeCandidates(
|
||||||
StoreNodes.push_back(MemOpLink(OtherST, PtrDiff));
|
StoreNodes.push_back(MemOpLink(OtherST, PtrDiff));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
for (auto I = RootNode->use_begin(), E = RootNode->use_end(); I != E; ++I)
|
for (auto I = RootNode->use_begin(), E = RootNode->use_end();
|
||||||
|
I != E && NumNodesExplored < 1024; ++I, ++NumNodesExplored)
|
||||||
if (I.getOperandNo() == 0)
|
if (I.getOperandNo() == 0)
|
||||||
if (StoreSDNode *OtherST = dyn_cast<StoreSDNode>(*I)) {
|
if (StoreSDNode *OtherST = dyn_cast<StoreSDNode>(*I)) {
|
||||||
BaseIndexOffset Ptr;
|
BaseIndexOffset Ptr;
|
||||||
|
|
Loading…
Reference in New Issue