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

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 6 05:33:46 PDT 2016


Author: d0k
Date: Sat Aug  6 07:33:46 2016
New Revision: 277922

URL: http://llvm.org/viewvc/llvm-project?rev=277922&view=rev
Log:
[Inliner] Use function_ref for functors which are never taken ownership of.

Modified:
    llvm/trunk/lib/Transforms/IPO/Inliner.cpp

Modified: llvm/trunk/lib/Transforms/IPO/Inliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Inliner.cpp?rev=277922&r1=277921&r2=277922&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Inliner.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Inliner.cpp Sat Aug  6 07:33:46 2016
@@ -94,7 +94,7 @@ typedef DenseMap<ArrayType *, std::vecto
 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, co
 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, CallS
 
 /// 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, CallG
                 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:");




More information about the llvm-commits mailing list