// Loop over the rest of the module, merging graphs for non-external functions
// into this graph.
//
// Loop over the rest of the module, merging graphs for non-external functions
// into this graph.
//
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isExternal()) {
hash_map<Value*, DSNodeHandle> ValMap;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isExternal()) {
hash_map<Value*, DSNodeHandle> ValMap;
for (hash_map<Value*, DSNodeHandle>::iterator I = ValMap.begin(),
E = ValMap.end(); I != E; ++I)
GVM[I->first].mergeWith(I->second);
for (hash_map<Value*, DSNodeHandle>::iterator I = ValMap.begin(),
E = ValMap.end(); I != E; ++I)
GVM[I->first].mergeWith(I->second);
+
+ if ((++Count & 1) == 0) // Prune nodes out every other time...
+ ResultGraph->removeTriviallyDeadNodes();
}
// FIXME: Must recalculate and use the Incomplete markers!!
}
// FIXME: Must recalculate and use the Incomplete markers!!
ResolveFunctionCall(F, CurCall, RetValMap[F]);
Eliminated = true;
}
ResolveFunctionCall(F, CurCall, RetValMap[F]);
Eliminated = true;
}
- if (Eliminated)
- CallTargets.erase(CallTargets.begin()+c);
- else
+ if (Eliminated) {
+ CallTargets[c] = CallTargets.back();
+ CallTargets.pop_back();
+ } else
++c; // Cannot eliminate this call, skip over it...
}
++c; // Cannot eliminate this call, skip over it...
}
- if (CallTargets.empty()) // Eliminated all calls?
- Calls.erase(Calls.begin()+i); // Remove from call list...
- else
+ if (CallTargets.empty()) { // Eliminated all calls?
+ CurCall = Calls.back(); // Remove entry
+ Calls.pop_back();
+ } else
++i; // Skip this call site...
}
++i; // Skip this call site...
}