mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-03 14:31:10 +00:00
Minor bugfixes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11005 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7e9bd80193
commit
17a93e2e1b
@ -1176,8 +1176,8 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F,
|
|||||||
// Advance the argument iterator to the first pointer argument...
|
// Advance the argument iterator to the first pointer argument...
|
||||||
while (AI != F.aend() && !isPointerType(AI->getType())) {
|
while (AI != F.aend() && !isPointerType(AI->getType())) {
|
||||||
++AI;
|
++AI;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG // FIXME: We should merge vararg arguments!
|
||||||
if (AI == F.aend())
|
if (AI == F.aend() && !F.getFunctionType()->isVarArg())
|
||||||
std::cerr << "Bad call to Function: " << F.getName() << "\n";
|
std::cerr << "Bad call to Function: " << F.getName() << "\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1227,8 +1227,8 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F,
|
|||||||
// Advance the argument iterator to the first pointer argument...
|
// Advance the argument iterator to the first pointer argument...
|
||||||
while (AI != F.aend() && !isPointerType(AI->getType())) {
|
while (AI != F.aend() && !isPointerType(AI->getType())) {
|
||||||
++AI;
|
++AI;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG // FIXME: We should merge varargs arguments!!
|
||||||
if (AI == F.aend())
|
if (AI == F.aend() && !F.getFunctionType()->isVarArg())
|
||||||
std::cerr << "Bad call to Function: " << F.getName() << "\n";
|
std::cerr << "Bad call to Function: " << F.getName() << "\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1490,14 +1490,18 @@ void DSGraph::removeTriviallyDeadNodes() {
|
|||||||
if (Node->getNumReferrers() == Node->getGlobals().size()) {
|
if (Node->getNumReferrers() == Node->getGlobals().size()) {
|
||||||
const std::vector<GlobalValue*> &Globals = Node->getGlobals();
|
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.
|
// 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()) {
|
if (Node->getNumReferrers() == Globals.size()) {
|
||||||
for (unsigned j = 0, e = Globals.size(); j != e; ++j)
|
for (unsigned j = 0, e = Globals.size(); j != e; ++j)
|
||||||
ScalarMap.erase(Globals[j]);
|
ScalarMap.erase(Globals[j]);
|
||||||
if (Node->hasNoReferrers())
|
Node->makeNodeDead();
|
||||||
Node->makeNodeDead();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user