diff --git a/llvm/lib/Analysis/DataStructure/GraphChecker.cpp b/llvm/lib/Analysis/DataStructure/GraphChecker.cpp index 67627480b6f3..34b3b55dc765 100644 --- a/llvm/lib/Analysis/DataStructure/GraphChecker.cpp +++ b/llvm/lib/Analysis/DataStructure/GraphChecker.cpp @@ -9,6 +9,8 @@ // --dsgc-abort-if-any-collapsed - Abort if any collapsed nodes are found // --dsgc-abort-if-collapsed= - Abort if a node pointed to by an SSA // value with name in is collapsed +// --dsgc-abort-if-incomplete=- Abort if any of the named SSA values +// are incomplete. // --dsgc-abort-if-merged= - Abort if any of the named SSA values // point to the same node. // @@ -36,6 +38,9 @@ namespace { AbortIfCollapsed("dsgc-abort-if-collapsed", cl::Hidden, cl::CommaSeparated, cl::desc("Abort if any of the named symbols is collapsed")); cl::list + AbortIfIncomplete("dsgc-abort-if-incomplete", cl::Hidden, cl::CommaSeparated, + cl::desc("Abort if any of the named symbols is incomplete")); + cl::list AbortIfMerged("dsgc-abort-if-merged", cl::Hidden, cl::CommaSeparated, cl::desc("Abort if any of the named symbols are merged together")); @@ -63,7 +68,7 @@ namespace { DSGC::DSGC() { if (!AbortIfAnyCollapsed && AbortIfCollapsed.empty() && - AbortIfMerged.empty()) { + AbortIfIncomplete.empty() && AbortIfMerged.empty()) { std::cerr << "The -datastructure-gc is useless if you don't specify any" " -dsgc-* options. See the -help-hidden output for a list.\n"; abort(); @@ -109,12 +114,15 @@ void DSGC::verify(const DSGraph &G) { } } - if (!AbortIfCollapsed.empty() || !AbortIfMerged.empty()) { + if (!AbortIfCollapsed.empty() || !AbortIfIncomplete.empty() || + !AbortIfMerged.empty()) { // Convert from a list to a set, because we don't have cl::set's yet. FIXME std::set AbortIfCollapsedS(AbortIfCollapsed.begin(), AbortIfCollapsed.end()); - std::set AbortIfMerged(AbortIfMerged.begin(), - AbortIfMerged.end()); + std::set AbortIfIncompleteS(AbortIfIncomplete.begin(), + AbortIfIncomplete.end()); + std::set AbortIfMergedS(AbortIfMerged.begin(), + AbortIfMerged.end()); // Now we loop over all of the scalars, checking to see if any are collapsed @@ -125,26 +133,31 @@ void DSGC::verify(const DSGraph &G) { for (DSGraph::ScalarMapTy::const_iterator I = SM.begin(), E = SM.end(); I != E; ++I) if (I->first->hasName() && I->second.getNode()) { + std::string Name = I->first->getName(); DSNode *N = I->second.getNode(); // Verify it is not collapsed if it is not supposed to be... - if (N->isNodeCompletelyFolded() && - AbortIfCollapsedS.count(I->first->getName())) { - std::cerr << "Node for value '%" << I->first->getName() - << "' is collapsed: "; + if (N->isNodeCompletelyFolded() && AbortIfCollapsedS.count(Name)) { + std::cerr << "Node for value '%" << Name << "' is collapsed: "; + N->print(std::cerr, &G); + abort(); + } + + if (N->isIncomplete() && AbortIfIncompleteS.count(Name)) { + std::cerr << "Node for value '%" << Name << "' is incomplete: "; N->print(std::cerr, &G); abort(); } // Verify that it is not merged if it is not supposed to be... - if (AbortIfMerged.count(I->first->getName())) { + if (AbortIfMergedS.count(Name)) { if (AbortIfMergedNodes.count(N)) { - std::cerr << "Nodes for values '%" << I->first->getName() - << "' and '%" << AbortIfMergedNodes[N] << "' is merged: "; + std::cerr << "Nodes for values '%" << Name << "' and '%" + << AbortIfMergedNodes[N] << "' is merged: "; N->print(std::cerr, &G); abort(); } - AbortIfMergedNodes[N] = I->first->getName(); + AbortIfMergedNodes[N] = Name; } } }