diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-31 21:05:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-31 21:05:58 +0000 |
commit | b45d9077cb036256532f7d6f0a80a6de524c0f19 (patch) | |
tree | b48a856b81dc0d0f0a110f3fbdfddc19966c411f /llvm/lib/Transforms/IPO/Inliner.cpp | |
parent | 9c4a58b7804d5dc5b9eb4c27e42c8509bf6d400d (diff) | |
download | bcm5719-llvm-b45d9077cb036256532f7d6f0a80a6de524c0f19.tar.gz bcm5719-llvm-b45d9077cb036256532f7d6f0a80a6de524c0f19.zip |
Strip off CPR's manually, because if we don't, the inliner doesn't delete dead
functions. GRR
llvm-svn: 9641
Diffstat (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 503879e4303..6c7a1914a95 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -13,6 +13,7 @@ //===----------------------------------------------------------------------===// #include "Inliner.h" +#include "llvm/Constants.h" // ConstantPointerRef should die #include "llvm/Module.h" #include "llvm/iOther.h" #include "llvm/iTerminators.h" @@ -108,12 +109,18 @@ bool Inliner::performInlining(CallSite CS, std::set<Function*> &SCC) { // Attempt to inline the function... if (!InlineFunction(CS)) return false; ++NumInlined; - + + if (Callee->hasOneUse()) + if (ConstantPointerRef *CPR = + dyn_cast<ConstantPointerRef>(Callee->use_back())) + if (CPR->use_empty()) + CPR->destroyConstant(); + // If we inlined the last possible call site to the function, // delete the function body now. if (Callee->use_empty() && Callee != Caller && (Callee->hasInternalLinkage() || Callee->hasLinkOnceLinkage())) { - DEBUG(std::cerr << " -> Deleting dead function: " + DEBUG(std::cerr << " -> Deleting dead function: " << (void*)Callee << Callee->getName() << "\n"); std::set<Function*>::iterator I = SCC.find(Callee); if (I != SCC.end()) // Remove function from this SCC... |