[Inliner] Use function_ref for functors which are never taken ownership of.

llvm-svn: 277922
This commit is contained in:
Benjamin Kramer 2016-08-06 12:33:46 +00:00
parent a3d4def878
commit 41e66dade1
1 changed files with 5 additions and 5 deletions

View File

@ -94,7 +94,7 @@ typedef DenseMap<ArrayType *, std::vector<AllocaInst *>> InlinedArrayAllocasTy;
static bool InlineCallIfPossible(
CallSite CS, InlineFunctionInfo &IFI,
InlinedArrayAllocasTy &InlinedArrayAllocas, int InlineHistory,
bool InsertLifetime, std::function<AAResults &(Function &)> &AARGetter,
bool InsertLifetime, function_ref<AAResults &(Function &)> AARGetter,
ImportedFunctionsInliningStatistics &ImportedFunctionsStats) {
Function *Callee = CS.getCalledFunction();
Function *Caller = CS.getCaller();
@ -252,7 +252,7 @@ static void emitAnalysis(CallSite CS, const Twine &Msg) {
static bool
shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC,
int &TotalSecondaryCost,
std::function<InlineCost(CallSite CS)> &GetInlineCost) {
function_ref<InlineCost(CallSite CS)> GetInlineCost) {
// For now we only handle local or inline functions.
if (!Caller->hasLocalLinkage() && !Caller->hasLinkOnceODRLinkage())
@ -323,7 +323,7 @@ shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC,
/// Return true if the inliner should attempt to inline at the given CallSite.
static bool shouldInline(CallSite CS,
std::function<InlineCost(CallSite CS)> GetInlineCost) {
function_ref<InlineCost(CallSite CS)> GetInlineCost) {
InlineCost IC = GetInlineCost(CS);
if (IC.isAlways()) {
@ -408,8 +408,8 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
std::function<AssumptionCache &(Function &)> GetAssumptionCache,
ProfileSummaryInfo *PSI, TargetLibraryInfo &TLI,
bool InsertLifetime,
std::function<InlineCost(CallSite CS)> GetInlineCost,
std::function<AAResults &(Function &)> AARGetter,
function_ref<InlineCost(CallSite CS)> GetInlineCost,
function_ref<AAResults &(Function &)> AARGetter,
ImportedFunctionsInliningStatistics &ImportedFunctionsStats) {
SmallPtrSet<Function *, 8> SCCFunctions;
DEBUG(dbgs() << "Inliner visiting SCC:");