[llvm] r280258 - [lib/LTO] Factor out logic for running passes.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 10:02:44 PDT 2016


Author: davide
Date: Wed Aug 31 12:02:44 2016
New Revision: 280258

URL: http://llvm.org/viewvc/llvm-project?rev=280258&view=rev
Log:
[lib/LTO] Factor out logic for running passes.

This is in preparation for adding an option
to run a custom pipeline with the new PM. It's
currently used in lld.

Modified:
    llvm/trunk/lib/LTO/LTOBackend.cpp

Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=280258&r1=280257&r2=280258&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Wed Aug 31 12:02:44 2016
@@ -114,10 +114,8 @@ createTargetMachine(Config &C, StringRef
       C.CodeModel, C.CGOptLevel));
 }
 
-bool opt(Config &C, TargetMachine *TM, unsigned Task, Module &M,
-         bool IsThinLto) {
-  M.setDataLayout(TM->createDataLayout());
-
+static void runOldPMPasses(Config &C, Module &M, TargetMachine *TM,
+                           bool IsThinLto) {
   legacy::PassManager passes;
   passes.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis()));
 
@@ -136,7 +134,12 @@ bool opt(Config &C, TargetMachine *TM, u
   else
     PMB.populateLTOPassManager(passes);
   passes.run(M);
+}
 
+bool opt(Config &C, TargetMachine *TM, unsigned Task, Module &M,
+         bool IsThinLto) {
+  M.setDataLayout(TM->createDataLayout());
+  runOldPMPasses(C, M, TM, IsThinLto);
   if (C.PostOptModuleHook && !C.PostOptModuleHook(Task, M))
     return false;
 




More information about the llvm-commits mailing list