[llvm-branch-commits] [llvm] 4bb11b3 - [LTO] Expose opt() in LTOBackend (NFC).

Florian Hahn via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 14 02:11:43 PST 2021


Author: Florian Hahn
Date: 2021-01-14T09:53:41Z
New Revision: 4bb11b3eafbde75ab026ec180cae62799ba0fb3c

URL: https://github.com/llvm/llvm-project/commit/4bb11b3eafbde75ab026ec180cae62799ba0fb3c
DIFF: https://github.com/llvm/llvm-project/commit/4bb11b3eafbde75ab026ec180cae62799ba0fb3c.diff

LOG: [LTO] Expose opt() in LTOBackend (NFC).

Exposing opt() which runs middle-end LTO optimzation allows re-using it
in LTOCodeGenerator.

Reviewed By: steven_wu

Differential Revision: https://reviews.llvm.org/D94486

Added: 
    

Modified: 
    llvm/include/llvm/LTO/LTOBackend.h
    llvm/lib/LTO/LTOBackend.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/LTO/LTOBackend.h b/llvm/include/llvm/LTO/LTOBackend.h
index db3c8c092ef9..824c7d143854 100644
--- a/llvm/include/llvm/LTO/LTOBackend.h
+++ b/llvm/include/llvm/LTO/LTOBackend.h
@@ -33,6 +33,12 @@ class Target;
 
 namespace lto {
 
+/// Runs middle-end LTO optimizations on \p Mod.
+bool opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
+         bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
+         const ModuleSummaryIndex *ImportSummary,
+         const std::vector<uint8_t> &CmdArgs);
+
 /// Runs a regular LTO backend. The regular LTO backend can also act as the
 /// regular LTO phase of ThinLTO, which may need to access the combined index.
 Error backend(const Config &C, AddStreamFn AddStream,

diff  --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 112a0c0897e8..effbdf6cfd9e 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -358,10 +358,10 @@ static void runOldPMPasses(const Config &Conf, Module &Mod, TargetMachine *TM,
   passes.run(Mod);
 }
 
-static bool opt(const Config &Conf, TargetMachine *TM, unsigned Task,
-                Module &Mod, bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
-                const ModuleSummaryIndex *ImportSummary,
-                const std::vector<uint8_t> &CmdArgs) {
+bool lto::opt(const Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
+              bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
+              const ModuleSummaryIndex *ImportSummary,
+              const std::vector<uint8_t> &CmdArgs) {
   if (EmbedBitcode == LTOBitcodeEmbedding::EmbedPostMergePreOptimized) {
     // FIXME: the motivation for capturing post-merge bitcode and command line
     // is replicating the compilation environment from bitcode, without needing


        


More information about the llvm-branch-commits mailing list