mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Elimiante calls to a node with nothing in it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4695 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -808,9 +808,17 @@ static void removeIdenticalCalls(vector<DSCallSite> &Calls,
|
||||
DSNode *LastCalleeNode = 0;
|
||||
unsigned NumDuplicateCalls = 0;
|
||||
bool LastCalleeContainsExternalFunction = false;
|
||||
for (unsigned i = 0, e = Calls.size(); i != e; ++i) {
|
||||
for (unsigned i = 0; i != Calls.size(); ++i) {
|
||||
DSCallSite &CS = Calls[i];
|
||||
|
||||
// If the Callee is a useless edge, this must be an unreachable call site,
|
||||
// eliminate it.
|
||||
killIfUselessEdge(CS.getCallee());
|
||||
if (CS.getCallee().getNode() == 0) {
|
||||
CS.swap(Calls.back());
|
||||
Calls.pop_back();
|
||||
--i;
|
||||
} else {
|
||||
// If the return value or any arguments point to a void node with no
|
||||
// information at all in it, and the call node is the only node to point
|
||||
// to it, remove the edge to the node (killing the node).
|
||||
@@ -820,9 +828,9 @@ static void removeIdenticalCalls(vector<DSCallSite> &Calls,
|
||||
killIfUselessEdge(CS.getPtrArg(a));
|
||||
|
||||
// If this call site calls the same function as the last call site, and if
|
||||
// the function pointer contains an external function, this node will never
|
||||
// be resolved. Merge the arguments of the call node because no information
|
||||
// will be lost.
|
||||
// the function pointer contains an external function, this node will
|
||||
// never be resolved. Merge the arguments of the call node because no
|
||||
// information will be lost.
|
||||
//
|
||||
if (CS.getCallee().getNode() == LastCalleeNode) {
|
||||
++NumDuplicateCalls;
|
||||
@@ -849,6 +857,7 @@ static void removeIdenticalCalls(vector<DSCallSite> &Calls,
|
||||
NumDuplicateCalls = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Calls.erase(std::unique(Calls.begin(), Calls.end()),
|
||||
Calls.end());
|
||||
|
Reference in New Issue
Block a user