mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-11 11:34:02 +00:00
Strip off CPR's manually, because if we don't, the inliner doesn't delete dead
functions. GRR git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9641 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
07a38e7b77
commit
bb9ae1512e
@ -13,6 +13,7 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "Inliner.h"
|
#include "Inliner.h"
|
||||||
|
#include "llvm/Constants.h" // ConstantPointerRef should die
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/iOther.h"
|
#include "llvm/iOther.h"
|
||||||
#include "llvm/iTerminators.h"
|
#include "llvm/iTerminators.h"
|
||||||
@ -109,11 +110,17 @@ bool Inliner::performInlining(CallSite CS, std::set<Function*> &SCC) {
|
|||||||
if (!InlineFunction(CS)) return false;
|
if (!InlineFunction(CS)) return false;
|
||||||
++NumInlined;
|
++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,
|
// If we inlined the last possible call site to the function,
|
||||||
// delete the function body now.
|
// delete the function body now.
|
||||||
if (Callee->use_empty() && Callee != Caller &&
|
if (Callee->use_empty() && Callee != Caller &&
|
||||||
(Callee->hasInternalLinkage() || Callee->hasLinkOnceLinkage())) {
|
(Callee->hasInternalLinkage() || Callee->hasLinkOnceLinkage())) {
|
||||||
DEBUG(std::cerr << " -> Deleting dead function: "
|
DEBUG(std::cerr << " -> Deleting dead function: " << (void*)Callee
|
||||||
<< Callee->getName() << "\n");
|
<< Callee->getName() << "\n");
|
||||||
std::set<Function*>::iterator I = SCC.find(Callee);
|
std::set<Function*>::iterator I = SCC.find(Callee);
|
||||||
if (I != SCC.end()) // Remove function from this SCC...
|
if (I != SCC.end()) // Remove function from this SCC...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user