From f7477470d37ee2ab9075eaee4745fa084d424ab8 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 9 Mar 2010 23:02:17 +0000 Subject: Try to keep the cached inliner costs around for a bit longer for big functions. The Caller cost info would be reset everytime a callee was inlined. If the caller has lots of calls and there is some mutual recursion going on, the caller cost info could be calculated many times. This patch reduces inliner runtime from 240s to 0.5s for a function with 20000 small function calls. This is a more conservative version of r98089 that doesn't break the clang test CodeGenCXX/temp-order.cpp. That test relies on rather extreme inlining for constant folding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98099 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/InlineCost.h | 5 +++++ include/llvm/Transforms/IPO/InlinerPass.h | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h index 84acd7d..f0e97d7 100644 --- a/include/llvm/Analysis/InlineCost.h +++ b/include/llvm/Analysis/InlineCost.h @@ -179,6 +179,11 @@ namespace llvm { void resetCachedCostInfo(Function* Caller) { CachedFunctionInfo[Caller] = FunctionInfo(); } + + /// growCachedCostInfo - update the cached cost info for Caller after Callee + /// has been inlined. If Callee is NULL it means a dead call has been + /// eliminated. + void growCachedCostInfo(Function* Caller, Function* Callee); }; } diff --git a/include/llvm/Transforms/IPO/InlinerPass.h b/include/llvm/Transforms/IPO/InlinerPass.h index 30ece0e..c5be59a 100644 --- a/include/llvm/Transforms/IPO/InlinerPass.h +++ b/include/llvm/Transforms/IPO/InlinerPass.h @@ -75,6 +75,10 @@ struct Inliner : public CallGraphSCCPass { /// virtual void resetCachedCostInfo(Function* Caller) = 0; + /// growCachedCostInfo - update the cached cost info for Caller after Callee + /// has been inlined. + virtual void growCachedCostInfo(Function* Caller, Function* Callee) = 0; + /// removeDeadFunctions - Remove dead functions that are not included in /// DNR (Do Not Remove) list. bool removeDeadFunctions(CallGraph &CG, -- cgit v1.1