forked from OSchip/llvm-project
Speed up cycle checking significantly by caching results.
llvm-svn: 96956
This commit is contained in:
parent
cd4c03e886
commit
d8ecd5e902
|
@ -6315,7 +6315,11 @@ bool ShuffleVectorSDNode::isSplatMask(const int *Mask, EVT VT) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkForCyclesHelper(const SDNode *N,
|
static void checkForCyclesHelper(const SDNode *N,
|
||||||
std::set<const SDNode *> &visited) {
|
std::set<const SDNode *> &visited,
|
||||||
|
std::set<const SDNode *> &checked) {
|
||||||
|
if (checked.find(N) != checked.end())
|
||||||
|
return;
|
||||||
|
|
||||||
if (visited.find(N) != visited.end()) {
|
if (visited.find(N) != visited.end()) {
|
||||||
dbgs() << "Offending node:\n";
|
dbgs() << "Offending node:\n";
|
||||||
N->dumprFull();
|
N->dumprFull();
|
||||||
|
@ -6329,16 +6333,18 @@ static void checkForCyclesHelper(const SDNode *N,
|
||||||
assert(inserted && "Missed cycle");
|
assert(inserted && "Missed cycle");
|
||||||
|
|
||||||
for(unsigned i = 0; i < N->getNumOperands(); ++i) {
|
for(unsigned i = 0; i < N->getNumOperands(); ++i) {
|
||||||
checkForCyclesHelper(N->getOperand(i).getNode(), visited);
|
checkForCyclesHelper(N->getOperand(i).getNode(), visited, checked);
|
||||||
}
|
}
|
||||||
visited.erase(i);
|
visited.erase(i);
|
||||||
|
checked.insert(N);
|
||||||
}
|
}
|
||||||
|
|
||||||
void llvm::checkForCycles(const llvm::SDNode *N) {
|
void llvm::checkForCycles(const llvm::SDNode *N) {
|
||||||
#ifdef XDEBUG
|
#ifdef XDEBUG
|
||||||
assert(N && "Checking nonexistant SDNode");
|
assert(N && "Checking nonexistant SDNode");
|
||||||
std::set<const SDNode *> visited;
|
std::set<const SDNode *> visited;
|
||||||
checkForCyclesHelper(N, visited);
|
std::set<const SDNode *> checked;
|
||||||
|
checkForCyclesHelper(N, visited, checked);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue