diff options
author | Dale Johannesen <dalej@apple.com> | 2009-01-12 22:11:50 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-01-12 22:11:50 +0000 |
commit | 5adaa754419fc9ee5d2f768ea848d594d1e97fe0 (patch) | |
tree | 1645efb483d9e0820b3f8cff1a9e3e6065a48d77 /lib | |
parent | 896b0f24b62a729616620e7258c883f6e76b5be2 (diff) | |
download | external_llvm-5adaa754419fc9ee5d2f768ea848d594d1e97fe0.zip external_llvm-5adaa754419fc9ee5d2f768ea848d594d1e97fe0.tar.gz external_llvm-5adaa754419fc9ee5d2f768ea848d594d1e97fe0.tar.bz2 |
Enable recursive inlining. Reduce inlining threshold
back to 200; 400 seems to be too high, loses more than
it gains.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62107 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/IPO/Inliner.cpp | 10 | ||||
-rw-r--r-- | lib/Transforms/Utils/InlineCost.cpp | 4 |
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index 65c0ace..8d40c9b 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/lib/Transforms/IPO/Inliner.cpp @@ -31,8 +31,8 @@ STATISTIC(NumInlined, "Number of functions inlined"); STATISTIC(NumDeleted, "Number of functions deleted because all callers found"); static cl::opt<int> -InlineLimit("inline-threshold", cl::Hidden, cl::init(400), - cl::desc("Control the amount of inlining to perform (default = 400)")); +InlineLimit("inline-threshold", cl::Hidden, cl::init(200), + cl::desc("Control the amount of inlining to perform (default = 200)")); Inliner::Inliner(void *ID) : CallGraphSCCPass(ID), InlineThreshold(InlineLimit) {} @@ -168,8 +168,7 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) { for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi) if (Function *Callee = CallSites[CSi].getCalledFunction()) { // Calls to external functions are never inlinable. - if (Callee->isDeclaration() || - CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){ + if (Callee->isDeclaration()) { if (SCC.size() == 1) { std::swap(CallSites[CSi], CallSites.back()); CallSites.pop_back(); @@ -190,7 +189,8 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) { if (InlineCallIfPossible(CS, CG, SCCFunctions, getAnalysis<TargetData>())) { // Remove any cached cost info for this caller, as inlining the callee - // has increased the size of the caller. + // has increased the size of the caller (which may be the same as the + // callee). resetCachedCostInfo(Caller); // Remove this call site from the list. If possible, use diff --git a/lib/Transforms/Utils/InlineCost.cpp b/lib/Transforms/Utils/InlineCost.cpp index 90d72ef..97f0bf8 100644 --- a/lib/Transforms/Utils/InlineCost.cpp +++ b/lib/Transforms/Utils/InlineCost.cpp @@ -180,14 +180,12 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS, Function *Callee = CS.getCalledFunction(); Function *Caller = TheCall->getParent()->getParent(); - // Don't inline a directly recursive call. - if (Caller == Callee || // Don't inline functions which can be redefined at link-time to mean // something else. // FIXME: We allow link-once linkage since in practice all versions of // the function have the same body (C++ ODR) - but the LLVM definition // of LinkOnceLinkage doesn't require this. - (Callee->mayBeOverridden() && !Callee->hasLinkOnceLinkage()) || + if ((Callee->mayBeOverridden() && !Callee->hasLinkOnceLinkage()) || // Don't inline functions marked noinline. Callee->hasFnAttr(Attribute::NoInline) || NeverInline.count(Callee)) return llvm::InlineCost::getNever(); |