[PATCH] D20267: [LTO] Add the ability to specify a subset of passes to run

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun May 15 10:31:36 PDT 2016


ruiu added a subscriber: ruiu.

================
Comment at: ELF/LTO.cpp:69-70
@@ -62,12 +68,4 @@
 static void runLTOPasses(Module &M, TargetMachine &TM) {
-  legacy::PassManager LtoPasses;
-  LtoPasses.add(createTargetTransformInfoWrapperPass(TM.getTargetIRAnalysis()));
-  PassManagerBuilder PMB;
-  PMB.LibraryInfo = new TargetLibraryInfoImpl(Triple(TM.getTargetTriple()));
-  PMB.Inliner = createFunctionInliningPass();
-  PMB.VerifyInput = PMB.VerifyOutput = !Config->DisableVerify;
-  PMB.LoopVectorize = true;
-  PMB.SLPVectorize = true;
-  PMB.OptLevel = Config->LtoO;
-  PMB.populateLTOPassManager(LtoPasses);
-  LtoPasses.run(M);
+
+  if (!Config->LtoNewPmPasses.empty()) {
+    // The user explicitly asked for a set of passes to be run.
----------------
Can you please split the function so that you can do

  if (!Config->LtoNewPmPasses.empty())
    runNewLtoPasses(M, TM);
  else
    runOldLtoPasses(M, TM);


================
Comment at: ELF/LTO.cpp:97-98
@@ +96,4 @@
+    // Now, add all the passes we've been requested to.
+    if (!PB.parsePassPipeline(MPM, Config->LtoNewPmPasses))
+      fatal("unable to parse pass pipeline description");
+
----------------
You need to handle the error gracefully (i.e. don't call fatal which exits) as it is a user-supplied command line option. Instead, please call error() here.

Please add a test to verify that it prints out an error message for an unknown --lto-newpm-passes argument.


http://reviews.llvm.org/D20267





More information about the llvm-commits mailing list