diff options
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/Analysis/InlineCost.h | 16 | ||||
-rw-r--r-- | llvm/include/llvm/Transforms/IPO/InlinerPass.h | 13 | ||||
-rw-r--r-- | llvm/include/llvm/Transforms/Utils/Cloning.h | 8 |
3 files changed, 17 insertions, 20 deletions
diff --git a/llvm/include/llvm/Analysis/InlineCost.h b/llvm/include/llvm/Analysis/InlineCost.h index 2928d2be30e..4dba56ce835 100644 --- a/llvm/include/llvm/Analysis/InlineCost.h +++ b/llvm/include/llvm/Analysis/InlineCost.h @@ -15,6 +15,7 @@ #define LLVM_ANALYSIS_INLINECOST_H #include "llvm/Analysis/CallGraphSCCPass.h" +#include "llvm/Analysis/AssumptionCache.h" #include <cassert> #include <climits> @@ -110,18 +111,21 @@ public: /// /// Also note that calling this function *dynamically* computes the cost of /// inlining the callsite. It is an expensive, heavyweight call. -InlineCost getInlineCost(CallSite CS, int DefaultThreshold, - TargetTransformInfo &CalleeTTI, - AssumptionCacheTracker *ACT, ProfileSummaryInfo *PSI); +InlineCost +getInlineCost(CallSite CS, int DefaultThreshold, TargetTransformInfo &CalleeTTI, + std::function<AssumptionCache &(Function &)> &GetAssumptionCache, + ProfileSummaryInfo *PSI); /// \brief Get an InlineCost with the callee explicitly specified. /// This allows you to calculate the cost of inlining a function via a /// pointer. This behaves exactly as the version with no explicit callee /// parameter in all other respects. // -InlineCost getInlineCost(CallSite CS, Function *Callee, int DefaultThreshold, - TargetTransformInfo &CalleeTTI, - AssumptionCacheTracker *ACT, ProfileSummaryInfo *PSI); +InlineCost +getInlineCost(CallSite CS, Function *Callee, int DefaultThreshold, + TargetTransformInfo &CalleeTTI, + std::function<AssumptionCache &(Function &)> &GetAssumptionCache, + ProfileSummaryInfo *PSI); int computeThresholdFromOptLevels(unsigned OptLevel, unsigned SizeOptLevel); diff --git a/llvm/include/llvm/Transforms/IPO/InlinerPass.h b/llvm/include/llvm/Transforms/IPO/InlinerPass.h index 59e10608a9b..f3d825ffa14 100644 --- a/llvm/include/llvm/Transforms/IPO/InlinerPass.h +++ b/llvm/include/llvm/Transforms/IPO/InlinerPass.h @@ -18,6 +18,8 @@ #define LLVM_TRANSFORMS_IPO_INLINERPASS_H #include "llvm/Analysis/CallGraphSCCPass.h" +#include "llvm/Analysis/InlineCost.h" +#include "llvm/Analysis/TargetTransformInfo.h" namespace llvm { class AssumptionCacheTracker; @@ -73,17 +75,6 @@ private: // InsertLifetime - Insert @llvm.lifetime intrinsics. bool InsertLifetime; - /// shouldInline - Return true if the inliner should attempt to - /// inline at the given CallSite. - bool shouldInline(CallSite CS); - /// Return true if inlining of CS can block the caller from being - /// inlined which is proved to be more beneficial. \p IC is the - /// estimated inline cost associated with callsite \p CS. - /// \p TotalAltCost will be set to the estimated cost of inlining the caller - /// if \p CS is suppressed for inlining. - bool shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC, - int &TotalAltCost); - protected: AssumptionCacheTracker *ACT; ProfileSummaryInfo *PSI; diff --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h index c5fb3700709..edba2bc66dd 100644 --- a/llvm/include/llvm/Transforms/Utils/Cloning.h +++ b/llvm/include/llvm/Transforms/Utils/Cloning.h @@ -21,6 +21,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Twine.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/AssumptionCache.h" #include "llvm/IR/ValueHandle.h" #include "llvm/IR/ValueMap.h" #include "llvm/Transforms/Utils/ValueMapper.h" @@ -176,13 +177,14 @@ void CloneAndPruneFunctionInto(Function *NewFunc, const Function *OldFunc, class InlineFunctionInfo { public: explicit InlineFunctionInfo(CallGraph *cg = nullptr, - AssumptionCacheTracker *ACT = nullptr) - : CG(cg), ACT(ACT) {} + std::function<AssumptionCache &(Function &)> + *GetAssumptionCache = nullptr) + : CG(cg), GetAssumptionCache(GetAssumptionCache) {} /// CG - If non-null, InlineFunction will update the callgraph to reflect the /// changes it makes. CallGraph *CG; - AssumptionCacheTracker *ACT; + std::function<AssumptionCache &(Function &)> *GetAssumptionCache; /// StaticAllocas - InlineFunction fills this in with all static allocas that /// get copied into the caller. |