1 //===- NewPMDriver.cpp - Driver for opt with new PM -----------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 ///
10 /// This file is just a split of the code that logically belongs in opt.cpp but
11 /// that includes the new pass manager headers.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #include "NewPMDriver.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Analysis/AliasAnalysis.h"
19 #include "llvm/Analysis/CGSCCPassManager.h"
20 #include "llvm/Analysis/TargetLibraryInfo.h"
21 #include "llvm/Bitcode/BitcodeWriterPass.h"
22 #include "llvm/Config/llvm-config.h"
23 #include "llvm/IR/Dominators.h"
24 #include "llvm/IR/IRPrintingPasses.h"
25 #include "llvm/IR/LLVMContext.h"
26 #include "llvm/IR/Module.h"
27 #include "llvm/IR/PassManager.h"
28 #include "llvm/IR/Verifier.h"
29 #include "llvm/Passes/PassBuilder.h"
30 #include "llvm/Passes/PassPlugin.h"
31 #include "llvm/Passes/StandardInstrumentations.h"
32 #include "llvm/Support/ErrorHandling.h"
33 #include "llvm/Support/ToolOutputFile.h"
34 #include "llvm/Target/TargetMachine.h"
35 #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
36 #include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
37 #include "llvm/Transforms/Scalar/LoopPassManager.h"
38 #include "llvm/Transforms/Utils/Debugify.h"
39 
40 using namespace llvm;
41 using namespace opt_tool;
42 
43 namespace llvm {
44 cl::opt<bool> DebugifyEach(
45     "debugify-each",
46     cl::desc("Start each pass with debugify and end it with check-debugify"));
47 
48 cl::opt<std::string>
49     DebugifyExport("debugify-export",
50                    cl::desc("Export per-pass debugify statistics to this file"),
51                    cl::value_desc("filename"));
52 } // namespace llvm
53 
54 enum class DebugLogging { None, Normal, Verbose, Quiet };
55 
56 static cl::opt<DebugLogging> DebugPM(
57     "debug-pass-manager", cl::Hidden, cl::ValueOptional,
58     cl::desc("Print pass management debugging information"),
59     cl::init(DebugLogging::None),
60     cl::values(
61         clEnumValN(DebugLogging::Normal, "", ""),
62         clEnumValN(DebugLogging::Quiet, "quiet",
63                    "Skip printing info about analyses"),
64         clEnumValN(
65             DebugLogging::Verbose, "verbose",
66             "Print extra information about adaptors and pass managers")));
67 
68 // This flag specifies a textual description of the alias analysis pipeline to
69 // use when querying for aliasing information. It only works in concert with
70 // the "passes" flag above.
71 static cl::opt<std::string>
72     AAPipeline("aa-pipeline",
73                cl::desc("A textual description of the alias analysis "
74                         "pipeline for handling managed aliasing queries"),
75                cl::Hidden, cl::init("default"));
76 
77 /// {{@ These options accept textual pipeline descriptions which will be
78 /// inserted into default pipelines at the respective extension points
79 static cl::opt<std::string> PeepholeEPPipeline(
80     "passes-ep-peephole",
81     cl::desc("A textual description of the function pass pipeline inserted at "
82              "the Peephole extension points into default pipelines"),
83     cl::Hidden);
84 static cl::opt<std::string> LateLoopOptimizationsEPPipeline(
85     "passes-ep-late-loop-optimizations",
86     cl::desc(
87         "A textual description of the loop pass pipeline inserted at "
88         "the LateLoopOptimizations extension point into default pipelines"),
89     cl::Hidden);
90 static cl::opt<std::string> LoopOptimizerEndEPPipeline(
91     "passes-ep-loop-optimizer-end",
92     cl::desc("A textual description of the loop pass pipeline inserted at "
93              "the LoopOptimizerEnd extension point into default pipelines"),
94     cl::Hidden);
95 static cl::opt<std::string> ScalarOptimizerLateEPPipeline(
96     "passes-ep-scalar-optimizer-late",
97     cl::desc("A textual description of the function pass pipeline inserted at "
98              "the ScalarOptimizerLate extension point into default pipelines"),
99     cl::Hidden);
100 static cl::opt<std::string> CGSCCOptimizerLateEPPipeline(
101     "passes-ep-cgscc-optimizer-late",
102     cl::desc("A textual description of the cgscc pass pipeline inserted at "
103              "the CGSCCOptimizerLate extension point into default pipelines"),
104     cl::Hidden);
105 static cl::opt<std::string> VectorizerStartEPPipeline(
106     "passes-ep-vectorizer-start",
107     cl::desc("A textual description of the function pass pipeline inserted at "
108              "the VectorizerStart extension point into default pipelines"),
109     cl::Hidden);
110 static cl::opt<std::string> PipelineStartEPPipeline(
111     "passes-ep-pipeline-start",
112     cl::desc("A textual description of the module pass pipeline inserted at "
113              "the PipelineStart extension point into default pipelines"),
114     cl::Hidden);
115 static cl::opt<std::string> PipelineEarlySimplificationEPPipeline(
116     "passes-ep-pipeline-early-simplification",
117     cl::desc("A textual description of the module pass pipeline inserted at "
118              "the EarlySimplification extension point into default pipelines"),
119     cl::Hidden);
120 static cl::opt<std::string> OptimizerEarlyEPPipeline(
121     "passes-ep-optimizer-early",
122     cl::desc("A textual description of the module pass pipeline inserted at "
123              "the OptimizerEarly extension point into default pipelines"),
124     cl::Hidden);
125 static cl::opt<std::string> OptimizerLastEPPipeline(
126     "passes-ep-optimizer-last",
127     cl::desc("A textual description of the module pass pipeline inserted at "
128              "the OptimizerLast extension point into default pipelines"),
129     cl::Hidden);
130 static cl::opt<std::string> FullLinkTimeOptimizationEarlyEPPipeline(
131     "passes-ep-full-link-time-optimization-early",
132     cl::desc("A textual description of the module pass pipeline inserted at "
133              "the FullLinkTimeOptimizationEarly extension point into default "
134              "pipelines"),
135     cl::Hidden);
136 static cl::opt<std::string> FullLinkTimeOptimizationLastEPPipeline(
137     "passes-ep-full-link-time-optimization-last",
138     cl::desc("A textual description of the module pass pipeline inserted at "
139              "the FullLinkTimeOptimizationLast extension point into default "
140              "pipelines"),
141     cl::Hidden);
142 
143 // Individual pipeline tuning options.
144 extern cl::opt<bool> DisableLoopUnrolling;
145 
146 namespace llvm {
147 extern cl::opt<PGOKind> PGOKindFlag;
148 extern cl::opt<std::string> ProfileFile;
149 extern cl::opt<CSPGOKind> CSPGOKindFlag;
150 extern cl::opt<std::string> CSProfileGenFile;
151 extern cl::opt<bool> DisableBasicAA;
152 extern cl::opt<bool> PrintPipelinePasses;
153 } // namespace llvm
154 
155 static cl::opt<std::string>
156     ProfileRemappingFile("profile-remapping-file",
157                          cl::desc("Path to the profile remapping file."),
158                          cl::Hidden);
159 static cl::opt<bool> DebugInfoForProfiling(
160     "new-pm-debug-info-for-profiling", cl::init(false), cl::Hidden,
161     cl::desc("Emit special debug info to enable PGO profile generation."));
162 static cl::opt<bool> PseudoProbeForProfiling(
163     "new-pm-pseudo-probe-for-profiling", cl::init(false), cl::Hidden,
164     cl::desc("Emit pseudo probes to enable PGO profile generation."));
165 /// @}}
166 
167 template <typename PassManagerT>
168 bool tryParsePipelineText(PassBuilder &PB,
169                           const cl::opt<std::string> &PipelineOpt) {
170   if (PipelineOpt.empty())
171     return false;
172 
173   // Verify the pipeline is parseable:
174   PassManagerT PM;
175   if (auto Err = PB.parsePassPipeline(PM, PipelineOpt)) {
176     errs() << "Could not parse -" << PipelineOpt.ArgStr
177            << " pipeline: " << toString(std::move(Err))
178            << "... I'm going to ignore it.\n";
179     return false;
180   }
181   return true;
182 }
183 
184 /// If one of the EPPipeline command line options was given, register callbacks
185 /// for parsing and inserting the given pipeline
186 static void registerEPCallbacks(PassBuilder &PB) {
187   if (tryParsePipelineText<FunctionPassManager>(PB, PeepholeEPPipeline))
188     PB.registerPeepholeEPCallback(
189         [&PB](FunctionPassManager &PM, OptimizationLevel Level) {
190           ExitOnError Err("Unable to parse PeepholeEP pipeline: ");
191           Err(PB.parsePassPipeline(PM, PeepholeEPPipeline));
192         });
193   if (tryParsePipelineText<LoopPassManager>(PB,
194                                             LateLoopOptimizationsEPPipeline))
195     PB.registerLateLoopOptimizationsEPCallback(
196         [&PB](LoopPassManager &PM, OptimizationLevel Level) {
197           ExitOnError Err("Unable to parse LateLoopOptimizationsEP pipeline: ");
198           Err(PB.parsePassPipeline(PM, LateLoopOptimizationsEPPipeline));
199         });
200   if (tryParsePipelineText<LoopPassManager>(PB, LoopOptimizerEndEPPipeline))
201     PB.registerLoopOptimizerEndEPCallback(
202         [&PB](LoopPassManager &PM, OptimizationLevel Level) {
203           ExitOnError Err("Unable to parse LoopOptimizerEndEP pipeline: ");
204           Err(PB.parsePassPipeline(PM, LoopOptimizerEndEPPipeline));
205         });
206   if (tryParsePipelineText<FunctionPassManager>(PB,
207                                                 ScalarOptimizerLateEPPipeline))
208     PB.registerScalarOptimizerLateEPCallback(
209         [&PB](FunctionPassManager &PM, OptimizationLevel Level) {
210           ExitOnError Err("Unable to parse ScalarOptimizerLateEP pipeline: ");
211           Err(PB.parsePassPipeline(PM, ScalarOptimizerLateEPPipeline));
212         });
213   if (tryParsePipelineText<CGSCCPassManager>(PB, CGSCCOptimizerLateEPPipeline))
214     PB.registerCGSCCOptimizerLateEPCallback(
215         [&PB](CGSCCPassManager &PM, OptimizationLevel Level) {
216           ExitOnError Err("Unable to parse CGSCCOptimizerLateEP pipeline: ");
217           Err(PB.parsePassPipeline(PM, CGSCCOptimizerLateEPPipeline));
218         });
219   if (tryParsePipelineText<FunctionPassManager>(PB, VectorizerStartEPPipeline))
220     PB.registerVectorizerStartEPCallback(
221         [&PB](FunctionPassManager &PM, OptimizationLevel Level) {
222           ExitOnError Err("Unable to parse VectorizerStartEP pipeline: ");
223           Err(PB.parsePassPipeline(PM, VectorizerStartEPPipeline));
224         });
225   if (tryParsePipelineText<ModulePassManager>(PB, PipelineStartEPPipeline))
226     PB.registerPipelineStartEPCallback(
227         [&PB](ModulePassManager &PM, OptimizationLevel) {
228           ExitOnError Err("Unable to parse PipelineStartEP pipeline: ");
229           Err(PB.parsePassPipeline(PM, PipelineStartEPPipeline));
230         });
231   if (tryParsePipelineText<ModulePassManager>(
232           PB, PipelineEarlySimplificationEPPipeline))
233     PB.registerPipelineEarlySimplificationEPCallback(
234         [&PB](ModulePassManager &PM, OptimizationLevel) {
235           ExitOnError Err("Unable to parse EarlySimplification pipeline: ");
236           Err(PB.parsePassPipeline(PM, PipelineEarlySimplificationEPPipeline));
237         });
238   if (tryParsePipelineText<ModulePassManager>(PB, OptimizerEarlyEPPipeline))
239     PB.registerOptimizerEarlyEPCallback(
240         [&PB](ModulePassManager &PM, OptimizationLevel) {
241           ExitOnError Err("Unable to parse OptimizerEarlyEP pipeline: ");
242           Err(PB.parsePassPipeline(PM, OptimizerEarlyEPPipeline));
243         });
244   if (tryParsePipelineText<ModulePassManager>(PB, OptimizerLastEPPipeline))
245     PB.registerOptimizerLastEPCallback(
246         [&PB](ModulePassManager &PM, OptimizationLevel) {
247           ExitOnError Err("Unable to parse OptimizerLastEP pipeline: ");
248           Err(PB.parsePassPipeline(PM, OptimizerLastEPPipeline));
249         });
250   if (tryParsePipelineText<ModulePassManager>(
251           PB, FullLinkTimeOptimizationEarlyEPPipeline))
252     PB.registerFullLinkTimeOptimizationEarlyEPCallback(
253         [&PB](ModulePassManager &PM, OptimizationLevel) {
254           ExitOnError Err(
255               "Unable to parse FullLinkTimeOptimizationEarlyEP pipeline: ");
256           Err(PB.parsePassPipeline(PM,
257                                    FullLinkTimeOptimizationEarlyEPPipeline));
258         });
259   if (tryParsePipelineText<ModulePassManager>(
260           PB, FullLinkTimeOptimizationLastEPPipeline))
261     PB.registerFullLinkTimeOptimizationLastEPCallback(
262         [&PB](ModulePassManager &PM, OptimizationLevel) {
263           ExitOnError Err(
264               "Unable to parse FullLinkTimeOptimizationLastEP pipeline: ");
265           Err(PB.parsePassPipeline(PM, FullLinkTimeOptimizationLastEPPipeline));
266         });
267 }
268 
269 #define HANDLE_EXTENSION(Ext)                                                  \
270   llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
271 #include "llvm/Support/Extension.def"
272 
273 bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
274                            TargetLibraryInfoImpl *TLII, ToolOutputFile *Out,
275                            ToolOutputFile *ThinLTOLinkOut,
276                            ToolOutputFile *OptRemarkFile,
277                            StringRef PassPipeline, ArrayRef<StringRef> Passes,
278                            ArrayRef<PassPlugin> PassPlugins,
279                            OutputKind OK, VerifierKind VK,
280                            bool ShouldPreserveAssemblyUseListOrder,
281                            bool ShouldPreserveBitcodeUseListOrder,
282                            bool EmitSummaryIndex, bool EmitModuleHash,
283                            bool EnableDebugify) {
284   bool VerifyEachPass = VK == VK_VerifyEachPass;
285 
286   Optional<PGOOptions> P;
287   switch (PGOKindFlag) {
288   case InstrGen:
289     P = PGOOptions(ProfileFile, "", "", PGOOptions::IRInstr);
290     break;
291   case InstrUse:
292     P = PGOOptions(ProfileFile, "", ProfileRemappingFile, PGOOptions::IRUse);
293     break;
294   case SampleUse:
295     P = PGOOptions(ProfileFile, "", ProfileRemappingFile,
296                    PGOOptions::SampleUse);
297     break;
298   case NoPGO:
299     if (DebugInfoForProfiling || PseudoProbeForProfiling)
300       P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
301                      DebugInfoForProfiling, PseudoProbeForProfiling);
302     else
303       P = None;
304   }
305   if (CSPGOKindFlag != NoCSPGO) {
306     if (P && (P->Action == PGOOptions::IRInstr ||
307               P->Action == PGOOptions::SampleUse))
308       errs() << "CSPGOKind cannot be used with IRInstr or SampleUse";
309     if (CSPGOKindFlag == CSInstrGen) {
310       if (CSProfileGenFile.empty())
311         errs() << "CSInstrGen needs to specify CSProfileGenFile";
312       if (P) {
313         P->CSAction = PGOOptions::CSIRInstr;
314         P->CSProfileGenFile = CSProfileGenFile;
315       } else
316         P = PGOOptions("", CSProfileGenFile, ProfileRemappingFile,
317                        PGOOptions::NoAction, PGOOptions::CSIRInstr);
318     } else /* CSPGOKindFlag == CSInstrUse */ {
319       if (!P)
320         errs() << "CSInstrUse needs to be together with InstrUse";
321       P->CSAction = PGOOptions::CSIRUse;
322     }
323   }
324   if (TM)
325     TM->setPGOOption(P);
326 
327   LoopAnalysisManager LAM;
328   FunctionAnalysisManager FAM;
329   CGSCCAnalysisManager CGAM;
330   ModuleAnalysisManager MAM;
331 
332   PassInstrumentationCallbacks PIC;
333   PrintPassOptions PrintPassOpts;
334   PrintPassOpts.Verbose = DebugPM == DebugLogging::Verbose;
335   PrintPassOpts.SkipAnalyses = DebugPM == DebugLogging::Quiet;
336   StandardInstrumentations SI(DebugPM != DebugLogging::None, VerifyEachPass,
337                               PrintPassOpts);
338   SI.registerCallbacks(PIC, &FAM);
339   DebugifyEachInstrumentation Debugify;
340   if (DebugifyEach)
341     Debugify.registerCallbacks(PIC);
342 
343   PipelineTuningOptions PTO;
344   // LoopUnrolling defaults on to true and DisableLoopUnrolling is initialized
345   // to false above so we shouldn't necessarily need to check whether or not the
346   // option has been enabled.
347   PTO.LoopUnrolling = !DisableLoopUnrolling;
348   PassBuilder PB(TM, PTO, P, &PIC);
349   registerEPCallbacks(PB);
350 
351   // For any loaded plugins, let them register pass builder callbacks.
352   for (auto &PassPlugin : PassPlugins)
353     PassPlugin.registerPassBuilderCallbacks(PB);
354 
355   PB.registerPipelineParsingCallback(
356       [](StringRef Name, ModulePassManager &MPM,
357          ArrayRef<PassBuilder::PipelineElement>) {
358         AddressSanitizerOptions Opts;
359         if (Name == "asan-pipeline") {
360           MPM.addPass(
361               RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
362           MPM.addPass(ModuleAddressSanitizerPass(Opts));
363           return true;
364         }
365         return false;
366       });
367 
368 #define HANDLE_EXTENSION(Ext)                                                  \
369   get##Ext##PluginInfo().RegisterPassBuilderCallbacks(PB);
370 #include "llvm/Support/Extension.def"
371 
372   // Specially handle the alias analysis manager so that we can register
373   // a custom pipeline of AA passes with it.
374   AAManager AA;
375   if (Passes.empty()) {
376     if (auto Err = PB.parseAAPipeline(AA, AAPipeline)) {
377       errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
378       return false;
379     }
380   }
381 
382   // For compatibility with the legacy PM AA pipeline.
383   // AAResultsWrapperPass by default provides basic-aa in the legacy PM
384   // unless -disable-basic-aa is specified.
385   // TODO: remove this once tests implicitly requiring basic-aa use -passes= and
386   // -aa-pipeline=basic-aa.
387   if (!Passes.empty() && !DisableBasicAA) {
388     if (auto Err = PB.parseAAPipeline(AA, "basic-aa")) {
389       errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
390       return false;
391     }
392   }
393 
394   // For compatibility with legacy pass manager.
395   // Alias analyses are not specially specified when using the legacy PM.
396   for (auto PassName : Passes) {
397     if (PB.isAAPassName(PassName)) {
398       if (auto Err = PB.parseAAPipeline(AA, PassName)) {
399         errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
400         return false;
401       }
402     }
403   }
404 
405   // Register the AA manager first so that our version is the one used.
406   FAM.registerPass([&] { return std::move(AA); });
407   // Register our TargetLibraryInfoImpl.
408   FAM.registerPass([&] { return TargetLibraryAnalysis(*TLII); });
409 
410   // Register all the basic analyses with the managers.
411   PB.registerModuleAnalyses(MAM);
412   PB.registerCGSCCAnalyses(CGAM);
413   PB.registerFunctionAnalyses(FAM);
414   PB.registerLoopAnalyses(LAM);
415   PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
416 
417   ModulePassManager MPM;
418   if (VK > VK_NoVerifier)
419     MPM.addPass(VerifierPass());
420   if (EnableDebugify)
421     MPM.addPass(NewPMDebugifyPass());
422 
423   // Add passes according to the -passes options.
424   if (!PassPipeline.empty()) {
425     assert(Passes.empty() &&
426            "PassPipeline and Passes should not both contain passes");
427     if (auto Err = PB.parsePassPipeline(MPM, PassPipeline)) {
428       errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
429       return false;
430     }
431   }
432   // Add passes specified using the legacy PM syntax (i.e. not using
433   // -passes). This should be removed later when such support has been
434   // deprecated, i.e. when all lit tests running opt (and not using
435   // -enable-new-pm=0) have been updated to use -passes.
436   for (auto PassName : Passes) {
437     std::string ModifiedPassName(PassName.begin(), PassName.end());
438     if (PB.isAnalysisPassName(PassName))
439       ModifiedPassName = "require<" + ModifiedPassName + ">";
440     // FIXME: These translations are supposed to be removed when lit tests that
441     // use these names have been updated to use the -passes syntax (and when the
442     // support for using the old syntax to specify passes is considered as
443     // deprecated for the new PM).
444     if (ModifiedPassName == "early-cse-memssa")
445       ModifiedPassName = "early-cse<memssa>";
446     else if (ModifiedPassName == "post-inline-ee-instrument")
447       ModifiedPassName = "ee-instrument<post-inline>";
448     else if (ModifiedPassName == "loop-extract-single")
449       ModifiedPassName = "loop-extract<single>";
450     else if (ModifiedPassName == "lower-matrix-intrinsics-minimal")
451       ModifiedPassName = "lower-matrix-intrinsics<minimal>";
452     if (auto Err = PB.parsePassPipeline(MPM, ModifiedPassName)) {
453       errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
454       return false;
455     }
456   }
457 
458   if (VK > VK_NoVerifier)
459     MPM.addPass(VerifierPass());
460   if (EnableDebugify)
461     MPM.addPass(NewPMCheckDebugifyPass());
462 
463   // Add any relevant output pass at the end of the pipeline.
464   switch (OK) {
465   case OK_NoOutput:
466     break; // No output pass needed.
467   case OK_OutputAssembly:
468     MPM.addPass(
469         PrintModulePass(Out->os(), "", ShouldPreserveAssemblyUseListOrder));
470     break;
471   case OK_OutputBitcode:
472     MPM.addPass(BitcodeWriterPass(Out->os(), ShouldPreserveBitcodeUseListOrder,
473                                   EmitSummaryIndex, EmitModuleHash));
474     break;
475   case OK_OutputThinLTOBitcode:
476     MPM.addPass(ThinLTOBitcodeWriterPass(
477         Out->os(), ThinLTOLinkOut ? &ThinLTOLinkOut->os() : nullptr));
478     break;
479   }
480 
481   // Before executing passes, print the final values of the LLVM options.
482   cl::PrintOptionValues();
483 
484   // Print a textual, '-passes=' compatible, representation of pipeline if
485   // requested.
486   if (PrintPipelinePasses) {
487     MPM.printPipeline(outs(), [&PIC](StringRef ClassName) {
488       auto PassName = PIC.getPassNameForClassName(ClassName);
489       return PassName.empty() ? ClassName : PassName;
490     });
491     outs() << "\n";
492     return true;
493   }
494 
495   // Now that we have all of the passes ready, run them.
496   MPM.run(M, MAM);
497 
498   // Declare success.
499   if (OK != OK_NoOutput) {
500     Out->keep();
501     if (OK == OK_OutputThinLTOBitcode && ThinLTOLinkOut)
502       ThinLTOLinkOut->keep();
503   }
504 
505   if (OptRemarkFile)
506     OptRemarkFile->keep();
507 
508   if (DebugifyEach && !DebugifyExport.empty())
509     exportDebugifyStats(DebugifyExport, Debugify.StatsMap);
510 
511   return true;
512 }
513 
514 void llvm::printPasses(raw_ostream &OS) {
515   PassBuilder PB;
516   PB.printPassNames(OS);
517 }
518