[PATCH] D19640: Update opt-bisect code to avoid skipping AlwaysInliner

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 11:10:15 PDT 2016


andrew.w.kaylor updated this revision to Diff 58122.
andrew.w.kaylor added a comment.

Refactored implementation as suggested.


Repository:
  rL LLVM

http://reviews.llvm.org/D19640

Files:
  include/llvm/Transforms/IPO/InlinerPass.h
  lib/Transforms/IPO/InlineAlways.cpp
  lib/Transforms/IPO/Inliner.cpp

Index: lib/Transforms/IPO/Inliner.cpp
===================================================================
--- lib/Transforms/IPO/Inliner.cpp
+++ lib/Transforms/IPO/Inliner.cpp
@@ -368,7 +368,10 @@
 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();
Index: lib/Transforms/IPO/InlineAlways.cpp
===================================================================
--- lib/Transforms/IPO/InlineAlways.cpp
+++ lib/Transforms/IPO/InlineAlways.cpp
@@ -45,6 +45,9 @@
     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;
Index: include/llvm/Transforms/IPO/InlinerPass.h
===================================================================
--- include/llvm/Transforms/IPO/InlinerPass.h
+++ include/llvm/Transforms/IPO/InlinerPass.h
@@ -62,6 +62,12 @@
   /// 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19640.58122.patch
Type: text/x-patch
Size: 1894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160523/9dc89d15/attachment.bin>


More information about the llvm-commits mailing list