mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Do now allow InlineAlways pass to remove dead functions.
llvm-svn: 58744
This commit is contained in:
parent
b55a78e553
commit
de9b95965a
@ -61,6 +61,10 @@ struct Inliner : public CallGraphSCCPass {
|
||||
///
|
||||
virtual float getInlineFudgeFactor(CallSite CS) = 0;
|
||||
|
||||
/// removeDeadFunctions - Remove dead functions that are not included in
|
||||
/// DNR (Do Not Remove) list.
|
||||
bool removeDeadFunctions(CallGraph &CG,
|
||||
SmallPtrSet<const Function *, 16> *DNR = NULL);
|
||||
private:
|
||||
// InlineThreshold - Cache the value here for easy access.
|
||||
unsigned InlineThreshold;
|
||||
|
@ -45,6 +45,9 @@ namespace {
|
||||
float getInlineFudgeFactor(CallSite CS) {
|
||||
return CA.getInlineFudgeFactor(CS);
|
||||
}
|
||||
virtual bool doFinalization(CallGraph &CG) {
|
||||
return removeDeadFunctions(CG, &NeverInline);
|
||||
}
|
||||
virtual bool doInitialization(CallGraph &CG);
|
||||
};
|
||||
}
|
||||
|
@ -204,6 +204,13 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
|
||||
// doFinalization - Remove now-dead linkonce functions at the end of
|
||||
// processing to avoid breaking the SCC traversal.
|
||||
bool Inliner::doFinalization(CallGraph &CG) {
|
||||
return removeDeadFunctions(CG);
|
||||
}
|
||||
|
||||
/// removeDeadFunctions - Remove dead functions that are not included in
|
||||
/// DNR (Do Not Remove) list.
|
||||
bool Inliner::removeDeadFunctions(CallGraph &CG,
|
||||
SmallPtrSet<const Function *, 16> *DNR) {
|
||||
std::set<CallGraphNode*> FunctionsToRemove;
|
||||
|
||||
// Scan for all of the functions, looking for ones that should now be removed
|
||||
@ -215,6 +222,9 @@ bool Inliner::doFinalization(CallGraph &CG) {
|
||||
// them.
|
||||
F->removeDeadConstantUsers();
|
||||
|
||||
if (DNR && DNR->count(F))
|
||||
continue;
|
||||
|
||||
if ((F->hasLinkOnceLinkage() || F->hasInternalLinkage()) &&
|
||||
F->use_empty()) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user