diff options
-rw-r--r-- | llvm/include/llvm/Transforms/IPO/InlinerPass.h | 6 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/InlineAlways.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 3 |
3 files changed, 12 insertions, 0 deletions
diff --git a/llvm/include/llvm/Transforms/IPO/InlinerPass.h b/llvm/include/llvm/Transforms/IPO/InlinerPass.h index 9fc702646b4..e911f2e34a3 100644 --- a/llvm/include/llvm/Transforms/IPO/InlinerPass.h +++ b/llvm/include/llvm/Transforms/IPO/InlinerPass.h @@ -62,6 +62,12 @@ struct Inliner : public CallGraphSCCPass { /// deal with that subset of the functions. bool removeDeadFunctions(CallGraph &CG, bool AlwaysInlineOnly = false); + /// This function performs the main work of the pass. The default + /// of Inlinter::runOnSCC() calls skipSCC() before calling this method, but + /// derived classes which cannot be skipped can override that method and + /// call this function unconditionally. + bool inlineCalls(CallGraphSCC &SCC); + private: // InsertLifetime - Insert @llvm.lifetime intrinsics. bool InsertLifetime; diff --git a/llvm/lib/Transforms/IPO/InlineAlways.cpp b/llvm/lib/Transforms/IPO/InlineAlways.cpp index e7623a96300..c403bbf8ecc 100644 --- a/llvm/lib/Transforms/IPO/InlineAlways.cpp +++ b/llvm/lib/Transforms/IPO/InlineAlways.cpp @@ -45,6 +45,9 @@ public: initializeAlwaysInlinerPass(*PassRegistry::getPassRegistry()); } + /// Main run interface method. We override here to avoid calling skipSCC(). + bool runOnSCC(CallGraphSCC &SCC) override { return inlineCalls(SCC); } + static char ID; // Pass identification, replacement for typeid InlineCost getInlineCost(CallSite CS) override; diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 03d996a4d5d..a3956ad296f 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -368,7 +368,10 @@ static bool InlineHistoryIncludes(Function *F, int InlineHistoryID, bool Inliner::runOnSCC(CallGraphSCC &SCC) { if (skipSCC(SCC)) return false; + return inlineCalls(SCC); +} +bool Inliner::inlineCalls(CallGraphSCC &SCC) { CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph(); ACT = &getAnalysis<AssumptionCacheTracker>(); auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(); |