diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-29 03:32:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-29 03:32:15 +0000 |
commit | c0f1e25c01ed7327359d92ba33866df99742f622 (patch) | |
tree | e4312673ea3913d4699e31e47f122ccdc3c485a2 /llvm/lib/Analysis/DataStructure/DataStructure.cpp | |
parent | 0119fba189e10201ff6d2174ff9adf5944cb151a (diff) | |
download | bcm5719-llvm-c0f1e25c01ed7327359d92ba33866df99742f622.tar.gz bcm5719-llvm-c0f1e25c01ed7327359d92ba33866df99742f622.zip |
Minor bugfixes
llvm-svn: 11005
Diffstat (limited to 'llvm/lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r-- | llvm/lib/Analysis/DataStructure/DataStructure.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/DataStructure/DataStructure.cpp b/llvm/lib/Analysis/DataStructure/DataStructure.cpp index 983dcf92ec6..9e0a0b9fc3a 100644 --- a/llvm/lib/Analysis/DataStructure/DataStructure.cpp +++ b/llvm/lib/Analysis/DataStructure/DataStructure.cpp @@ -1176,8 +1176,8 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, // Advance the argument iterator to the first pointer argument... while (AI != F.aend() && !isPointerType(AI->getType())) { ++AI; -#ifndef NDEBUG - if (AI == F.aend()) +#ifndef NDEBUG // FIXME: We should merge vararg arguments! + if (AI == F.aend() && !F.getFunctionType()->isVarArg()) std::cerr << "Bad call to Function: " << F.getName() << "\n"; #endif } @@ -1227,8 +1227,8 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F, // Advance the argument iterator to the first pointer argument... while (AI != F.aend() && !isPointerType(AI->getType())) { ++AI; -#ifndef NDEBUG - if (AI == F.aend()) +#ifndef NDEBUG // FIXME: We should merge varargs arguments!! + if (AI == F.aend() && !F.getFunctionType()->isVarArg()) std::cerr << "Bad call to Function: " << F.getName() << "\n"; #endif } @@ -1490,14 +1490,18 @@ void DSGraph::removeTriviallyDeadNodes() { if (Node->getNumReferrers() == Node->getGlobals().size()) { const std::vector<GlobalValue*> &Globals = Node->getGlobals(); + // Loop through and make sure all of the globals are referring directly + // to the node... + for (unsigned j = 0, e = Globals.size(); j != e; ++j) { + DSNode *N = getNodeForValue(Globals[j]).getNode(); + assert(N == Node && "ScalarMap doesn't match globals list!"); + } + // Make sure NumReferrers still agrees, if so, the node is truly dead. - // Remove the scalarmap entries, which will drop the actual referrer - // count to zero. if (Node->getNumReferrers() == Globals.size()) { for (unsigned j = 0, e = Globals.size(); j != e; ++j) ScalarMap.erase(Globals[j]); - if (Node->hasNoReferrers()) - Node->makeNodeDead(); + Node->makeNodeDead(); } } } |