Add sanity check

llvm-svn: 5489
This commit is contained in:
Chris Lattner 2003-02-04 00:03:57 +00:00
parent 96f37f267a
commit e8381114ef
2 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,10 @@ public:
~DSGraph();
bool hasFunction() const { return Func != 0; }
Function &getFunction() const { return *Func; }
Function &getFunction() const {
assert(hasFunction() && "Cannot call getFunction on graph without a fn!");
return *Func;
}
DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }

View File

@ -1029,6 +1029,7 @@ void DSGraph::removeDeadNodes(unsigned Flags) {
if (AuxFCallsAlive[i])
AuxFunctionCalls[CurIdx++].swap(AuxFunctionCalls[i]);
if (!(Flags & DSGraph::RemoveUnreachableGlobals)) {
assert(GlobalsGraph && "No globals graph available??");
// Move the unreachable call nodes to the globals graph...
GlobalsGraph->AuxFunctionCalls.insert(GlobalsGraph->AuxFunctionCalls.end(),
AuxFunctionCalls.begin()+CurIdx,