LLVM  14.0.0git
PassManagerBuilder.cpp
Go to the documentation of this file.
1 //===- PassManagerBuilder.cpp - Build Standard Pass -----------------------===//
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 //
9 // This file defines the PassManagerBuilder class, which is used to set up a
10 // "standard" optimization sequence suitable for languages like C and C++.
11 //
12 //===----------------------------------------------------------------------===//
13 
16 #include "llvm/ADT/STLExtras.h"
17 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/Analysis/Passes.h"
27 #include "llvm/IR/DataLayout.h"
29 #include "llvm/IR/Verifier.h"
30 #include "llvm/InitializePasses.h"
35 #include "llvm/Transforms/IPO.h"
42 #include "llvm/Transforms/Scalar.h"
49 #include "llvm/Transforms/Utils.h"
54 
55 using namespace llvm;
56 
57 namespace llvm {
58 cl::opt<bool> RunPartialInlining("enable-partial-inlining", cl::init(false),
60  cl::desc("Run Partial inlinining pass"));
61 
62 static cl::opt<bool>
63 UseGVNAfterVectorization("use-gvn-after-vectorization",
64  cl::init(false), cl::Hidden,
65  cl::desc("Run GVN instead of Early CSE after vectorization passes"));
66 
68  "extra-vectorizer-passes", cl::init(false), cl::Hidden,
69  cl::desc("Run cleanup optimization passes after vectorization."));
70 
71 static cl::opt<bool>
72 RunLoopRerolling("reroll-loops", cl::Hidden,
73  cl::desc("Run the loop rerolling pass"));
74 
75 cl::opt<bool> RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden,
76  cl::desc("Run the NewGVN pass"));
77 
78 // Experimental option to use CFL-AA
80  UseCFLAA("use-cfl-aa", cl::init(::CFLAAType::None), cl::Hidden,
81  cl::desc("Enable the new, experimental CFL alias analysis"),
82  cl::values(clEnumValN(::CFLAAType::None, "none", "Disable CFL-AA"),
84  "Enable unification-based CFL-AA"),
85  clEnumValN(::CFLAAType::Andersen, "anders",
86  "Enable inclusion-based CFL-AA"),
87  clEnumValN(::CFLAAType::Both, "both",
88  "Enable both variants of CFL-AA")));
89 
91  "enable-loopinterchange", cl::init(false), cl::Hidden,
92  cl::desc("Enable the experimental LoopInterchange Pass"));
93 
94 cl::opt<bool> EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false),
95  cl::Hidden,
96  cl::desc("Enable Unroll And Jam Pass"));
97 
98 cl::opt<bool> EnableLoopFlatten("enable-loop-flatten", cl::init(false),
99  cl::Hidden,
100  cl::desc("Enable the LoopFlatten Pass"));
101 
102 cl::opt<bool> EnableDFAJumpThreading("enable-dfa-jump-thread",
103  cl::desc("Enable DFA jump threading."),
104  cl::init(false), cl::Hidden);
105 
106 static cl::opt<bool>
107  EnablePrepareForThinLTO("prepare-for-thinlto", cl::init(false), cl::Hidden,
108  cl::desc("Enable preparation for ThinLTO."));
109 
110 static cl::opt<bool>
111  EnablePerformThinLTO("perform-thinlto", cl::init(false), cl::Hidden,
112  cl::desc("Enable performing ThinLTO."));
113 
114 cl::opt<bool> EnableHotColdSplit("hot-cold-split", cl::init(false),
115  cl::ZeroOrMore, cl::desc("Enable hot-cold splitting pass"));
116 
117 cl::opt<bool> EnableIROutliner("ir-outliner", cl::init(false), cl::Hidden,
118  cl::desc("Enable ir outliner pass"));
119 
121  "enable-loop-versioning-licm", cl::init(false), cl::Hidden,
122  cl::desc("Enable the experimental Loop Versioning LICM pass"));
123 
125  DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden,
126  cl::desc("Disable pre-instrumentation inliner"));
127 
129  "preinline-threshold", cl::Hidden, cl::init(75), cl::ZeroOrMore,
130  cl::desc("Control the amount of inlining in pre-instrumentation inliner "
131  "(default = 75)"));
132 
134  EnableGVNHoist("enable-gvn-hoist", cl::init(false), cl::ZeroOrMore,
135  cl::desc("Enable the GVN hoisting pass (default = off)"));
136 
137 static cl::opt<bool>
138  DisableLibCallsShrinkWrap("disable-libcalls-shrinkwrap", cl::init(false),
139  cl::Hidden,
140  cl::desc("Disable shrink-wrap library calls"));
141 
143  "enable-simple-loop-unswitch", cl::init(false), cl::Hidden,
144  cl::desc("Enable the simple loop unswitch pass. Also enables independent "
145  "cleanup passes integrated into the loop pass manager pipeline."));
146 
148  EnableGVNSink("enable-gvn-sink", cl::init(false), cl::ZeroOrMore,
149  cl::desc("Enable the GVN sinking pass (default = off)"));
150 
151 // This option is used in simplifying testing SampleFDO optimizations for
152 // profile loading.
154  EnableCHR("enable-chr", cl::init(true), cl::Hidden,
155  cl::desc("Enable control height reduction optimization (CHR)"));
156 
158  "flattened-profile-used", cl::init(false), cl::Hidden,
159  cl::desc("Indicate the sample profile being used is flattened, i.e., "
160  "no inline hierachy exists in the profile. "));
161 
163  "enable-order-file-instrumentation", cl::init(false), cl::Hidden,
164  cl::desc("Enable order file instrumentation (default = off)"));
165 
167  "enable-matrix", cl::init(false), cl::Hidden,
168  cl::desc("Enable lowering of the matrix intrinsics"));
169 
171  "enable-constraint-elimination", cl::init(false), cl::Hidden,
172  cl::desc(
173  "Enable pass to eliminate conditions based on linear constraints."));
174 
176  "enable-function-specialization", cl::init(false), cl::Hidden,
177  cl::desc("Enable Function Specialization pass"));
178 
180  "attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE),
181  cl::desc("Enable the attributor inter-procedural deduction pass."),
183  "enable all attributor runs"),
185  "enable module-wide attributor runs"),
187  "enable call graph SCC attributor runs"),
189  "disable attributor runs")));
190 
192 } // namespace llvm
193 
195  OptLevel = 2;
196  SizeLevel = 0;
197  LibraryInfo = nullptr;
198  Inliner = nullptr;
199  DisableUnrollLoops = false;
200  SLPVectorize = false;
201  LoopVectorize = true;
202  LoopsInterleaved = true;
204  NewGVN = RunNewGVN;
207  DisableGVNLoadPRE = false;
209  VerifyInput = false;
210  VerifyOutput = false;
211  MergeFunctions = false;
212  PrepareForLTO = false;
213  EnablePGOInstrGen = false;
214  EnablePGOCSInstrGen = false;
215  EnablePGOCSInstrUse = false;
216  PGOInstrGen = "";
217  PGOInstrUse = "";
218  PGOSampleUse = "";
221  DivergentTarget = false;
222  CallGraphProfile = true;
223 }
224 
226  delete LibraryInfo;
227  delete Inliner;
228 }
229 
230 /// Set of global extensions, automatically added as part of the standard set.
231 static ManagedStatic<
235  8>>
238 
239 /// Check if GlobalExtensions is constructed and not empty.
240 /// Since GlobalExtensions is a managed static, calling 'empty()' will trigger
241 /// the construction of the object.
243  return GlobalExtensions.isConstructed() && !GlobalExtensions->empty();
244 }
245 
249  auto ExtensionID = GlobalExtensionsCounter++;
250  GlobalExtensions->push_back(std::make_tuple(Ty, std::move(Fn), ExtensionID));
251  return ExtensionID;
252 }
253 
256  // RegisterStandardPasses may try to call this function after GlobalExtensions
257  // has already been destroyed; doing so should not generate an error.
258  if (!GlobalExtensions.isConstructed())
259  return;
260 
261  auto GlobalExtension =
262  llvm::find_if(*GlobalExtensions, [ExtensionID](const auto &elem) {
263  return std::get<2>(elem) == ExtensionID;
264  });
265  assert(GlobalExtension != GlobalExtensions->end() &&
266  "The extension ID to be removed should always be valid.");
267 
268  GlobalExtensions->erase(GlobalExtension);
269 }
270 
272  Extensions.push_back(std::make_pair(Ty, std::move(Fn)));
273 }
274 
275 void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy,
276  legacy::PassManagerBase &PM) const {
277  if (GlobalExtensionsNotEmpty()) {
278  for (auto &Ext : *GlobalExtensions) {
279  if (std::get<0>(Ext) == ETy)
280  std::get<1>(Ext)(*this, PM);
281  }
282  }
283  for (unsigned i = 0, e = Extensions.size(); i != e; ++i)
284  if (Extensions[i].first == ETy)
285  Extensions[i].second(*this, PM);
286 }
287 
288 void PassManagerBuilder::addInitialAliasAnalysisPasses(
289  legacy::PassManagerBase &PM) const {
290  switch (UseCFLAA) {
291  case ::CFLAAType::Steensgaard:
293  break;
294  case ::CFLAAType::Andersen:
296  break;
297  case ::CFLAAType::Both:
300  break;
301  default:
302  break;
303  }
304 
305  // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
306  // BasicAliasAnalysis wins if they disagree. This is intended to help
307  // support "obvious" type-punning idioms.
310 }
311 
314  addExtensionsToPM(EP_EarlyAsPossible, FPM);
315 
316  // Add LibraryInfo if we have some.
317  if (LibraryInfo)
319 
320  // The backends do not handle matrix intrinsics currently.
321  // Make sure they are also lowered in O0.
322  // FIXME: A lightweight version of the pass should run in the backend
323  // pipeline on demand.
324  if (EnableMatrix && OptLevel == 0)
326 
327  if (OptLevel == 0) return;
328 
329  addInitialAliasAnalysisPasses(FPM);
330 
331  // Lower llvm.expect to metadata before attempting transforms.
332  // Compare/branch metadata may alter the behavior of passes like SimplifyCFG.
335  FPM.add(createSROAPass());
336  FPM.add(createEarlyCSEPass());
337 }
338 
339 // Do PGO instrumentation generation or use pass as the option specified.
340 void PassManagerBuilder::addPGOInstrPasses(legacy::PassManagerBase &MPM,
341  bool IsCS = false) {
342  if (IsCS) {
344  return;
345  } else if (!EnablePGOInstrGen && PGOInstrUse.empty() && PGOSampleUse.empty())
346  return;
347 
348  // Perform the preinline and cleanup passes for O1 and above.
349  // We will not do this inline for context sensitive PGO (when IsCS is true).
350  if (OptLevel > 0 && !DisablePreInliner && PGOSampleUse.empty() && !IsCS) {
351  // Create preinline pass. We construct an InlineParams object and specify
352  // the threshold here to avoid the command line options of the regular
353  // inliner to influence pre-inlining. The only fields of InlineParams we
354  // care about are DefaultThreshold and HintThreshold.
356  IP.DefaultThreshold = PreInlineThreshold;
357  // FIXME: The hint threshold has the same value used by the regular inliner
358  // when not optimzing for size. This should probably be lowered after
359  // performance testing.
360  // Use PreInlineThreshold for both -Os and -Oz. Not running preinliner makes
361  // the instrumented binary unusably large. Even if PreInlineThreshold is not
362  // correct thresold for -Oz, it is better than not running preinliner.
363  IP.HintThreshold = SizeLevel > 0 ? PreInlineThreshold : 325;
364 
366  MPM.add(createSROAPass());
367  MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
368  MPM.add(createCFGSimplificationPass()); // Merge & remove BBs
369  MPM.add(createInstructionCombiningPass()); // Combine silly seq's
370  addExtensionsToPM(EP_Peephole, MPM);
371  }
372  if ((EnablePGOInstrGen && !IsCS) || (EnablePGOCSInstrGen && IsCS)) {
374  // Add the profile lowering pass.
376  if (!PGOInstrGen.empty())
377  Options.InstrProfileOutput = PGOInstrGen;
378  Options.DoCounterPromotion = true;
379  Options.UseBFIInPromotion = IsCS;
380  MPM.add(createLoopRotatePass());
382  }
383  if (!PGOInstrUse.empty())
385  // Indirect call promotion that promotes intra-module targets only.
386  // For ThinLTO this is done earlier due to interactions with globalopt
387  // for imported functions. We don't run this at -O0.
388  if (OptLevel > 0 && !IsCS)
389  MPM.add(
391 }
392 void PassManagerBuilder::addFunctionSimplificationPasses(
394  // Start of function pass.
395  // Break up aggregate allocas, using SSAUpdater.
396  assert(OptLevel >= 1 && "Calling function optimizer with no optimization level!");
397  MPM.add(createSROAPass());
398  MPM.add(createEarlyCSEPass(true /* Enable mem-ssa. */)); // Catch trivial redundancies
401 
402  if (OptLevel > 1) {
403  if (EnableGVNHoist)
404  MPM.add(createGVNHoistPass());
405  if (EnableGVNSink) {
406  MPM.add(createGVNSinkPass());
408  }
409  }
410 
413 
414  if (OptLevel > 1) {
415  // Speculative execution if the target has divergent branches; otherwise nop.
417 
418  MPM.add(createJumpThreadingPass()); // Thread jumps.
419  MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals
420  }
421  MPM.add(createCFGSimplificationPass()); // Merge & remove BBs
422  // Combine silly seq's
423  if (OptLevel > 2)
428  addExtensionsToPM(EP_Peephole, MPM);
429 
430  // Optimize memory intrinsic calls based on the profiled size information.
431  if (SizeLevel == 0)
433 
434  // TODO: Investigate the cost/benefit of tail call elimination on debugging.
435  if (OptLevel > 1)
436  MPM.add(createTailCallEliminationPass()); // Eliminate tail calls
437  MPM.add(createCFGSimplificationPass()); // Merge & remove BBs
438  MPM.add(createReassociatePass()); // Reassociate expressions
439 
440  // Begin the loop pass pipeline.
442  // The simple loop unswitch pass relies on separate cleanup passes. Schedule
443  // them first so when we re-process a loop they run before other loop
444  // passes.
447  }
448  // Try to remove as much code from the loop header as possible,
449  // to reduce amount of IR that will have to be duplicated.
450  // TODO: Investigate promotion cap for O1.
452  // Rotate Loop - disable header duplication at -Oz
453  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, PrepareForLTO));
454  // TODO: Investigate promotion cap for O1.
458  else
460  // FIXME: We break the loop pass pipeline here in order to do full
461  // simplifycfg. Eventually loop-simplifycfg should be enhanced to replace the
462  // need for this.
465  // We resume loop passes creating a second loop pipeline here.
466  if (EnableLoopFlatten) {
467  MPM.add(createLoopFlattenPass()); // Flatten loops
469  }
470  MPM.add(createLoopIdiomPass()); // Recognize idioms like memset.
471  MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars
472  addExtensionsToPM(EP_LateLoopOptimizations, MPM);
473  MPM.add(createLoopDeletionPass()); // Delete dead loops
474 
476  MPM.add(createLoopInterchangePass()); // Interchange loops
477 
478  // Unroll small loops and perform peeling.
481  addExtensionsToPM(EP_LoopOptimizerEnd, MPM);
482  // This ends the loop pass pipelines.
483 
484  // Break up allocas that may now be splittable after loop unrolling.
485  MPM.add(createSROAPass());
486 
487  if (OptLevel > 1) {
488  MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds
489  MPM.add(NewGVN ? createNewGVNPass()
490  : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
491  }
492  MPM.add(createSCCPPass()); // Constant prop with SCCP
493 
496 
497  // Delete dead bit computations (instcombine runs after to fold away the dead
498  // computations, and then ADCE will run later to exploit any new DCE
499  // opportunities that creates).
500  MPM.add(createBitTrackingDCEPass()); // Delete dead bit computations
501 
502  // Run instcombine after redundancy elimination to exploit opportunities
503  // opened up by them.
505  addExtensionsToPM(EP_Peephole, MPM);
506  if (OptLevel > 1) {
507  if (EnableDFAJumpThreading && SizeLevel == 0)
509 
510  MPM.add(createJumpThreadingPass()); // Thread jumps
512  }
513  MPM.add(createAggressiveDCEPass()); // Delete dead instructions
514 
515  MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset
516  // TODO: Investigate if this is too expensive at O1.
517  if (OptLevel > 1) {
518  MPM.add(createDeadStoreEliminationPass()); // Delete dead stores
520  }
521 
522  addExtensionsToPM(EP_ScalarOptimizerLate, MPM);
523 
524  if (RerollLoops)
525  MPM.add(createLoopRerollPass());
526 
527  // Merge & remove BBs and sink & hoist common instructions.
529  SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true)));
530  // Clean up after everything.
532  addExtensionsToPM(EP_Peephole, MPM);
533 
534  if (EnableCHR && OptLevel >= 3 &&
535  (!PGOInstrUse.empty() || !PGOSampleUse.empty() || EnablePGOCSInstrGen))
537 }
538 
539 /// FIXME: Should LTO cause any differences to this set of passes?
540 void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
541  bool IsFullLTO) {
543 
544  if (IsFullLTO) {
545  // The vectorizer may have significantly shortened a loop body; unroll
546  // again. Unroll small loops to hide loop backedge latency and saturate any
547  // parallel execution resources of an out-of-order processor. We also then
548  // need to clean up redundancies and loop invariant code.
549  // FIXME: It would be really good to use a loop-integrated instruction
550  // combiner for cleanup here so that the unrolling and LICM can be pipelined
551  // across the loop nests.
552  // We do UnrollAndJam in a separate LPM to ensure it happens before unroll
558  }
559 
560  if (!IsFullLTO) {
561  // Eliminate loads by forwarding stores from the previous iteration to loads
562  // of the current iteration.
564  }
565  // Cleanup after the loop optimization passes.
567 
568  if (OptLevel > 1 && ExtraVectorizerPasses) {
569  // At higher optimization levels, try to clean up any runtime overlap and
570  // alignment checks inserted by the vectorizer. We want to track correlated
571  // runtime checks for two inner loops in the same outer loop, fold any
572  // common computations, hoist loop-invariant aspects out of any outer loop,
573  // and unswitch the runtime checks if possible. Once hoisted, we may have
574  // dead (or speculatable) control flows or more combining opportunities.
575  PM.add(createEarlyCSEPass());
582  }
583 
584  // Now that we've formed fast to execute loop structures, we do further
585  // optimizations. These are run afterward as they might block doing complex
586  // analyses and transforms such as what are needed for loop vectorization.
587 
588  // Cleanup after loop vectorization, etc. Simplification passes like CVP and
589  // GVN, loop transforms, and others have already run, so it's now better to
590  // convert to more optimized IR using more aggressive simplify CFG options.
591  // The extra sinking transform can create larger basic blocks, so do this
592  // before SLP vectorization.
594  .forwardSwitchCondToPhi(true)
595  .convertSwitchToLookupTable(true)
596  .needCanonicalLoops(false)
597  .hoistCommonInsts(true)
598  .sinkCommonInsts(true)));
599 
600  if (IsFullLTO) {
601  PM.add(createSCCPPass()); // Propagate exposed constants
602  PM.add(createInstructionCombiningPass()); // Clean up again
604  }
605 
606  // Optimize parallel scalar instruction chains into SIMD instructions.
607  if (SLPVectorize) {
609  if (OptLevel > 1 && ExtraVectorizerPasses)
610  PM.add(createEarlyCSEPass());
611  }
612 
613  // Enhance/cleanup vector code.
615 
616  if (!IsFullLTO) {
617  addExtensionsToPM(EP_Peephole, PM);
619 
621  // Unroll and Jam. We do this before unroll but need to be in a separate
622  // loop pass manager in order for the outer loop to be processed by
623  // unroll and jam before the inner loop is unrolled.
625  }
626 
627  // Unroll small loops
630 
631  if (!DisableUnrollLoops) {
632  // LoopUnroll may generate some redundency to cleanup.
634 
635  // Runtime unrolling will introduce runtime check in loop prologue. If the
636  // unrolled loop is a inner loop, then the prologue will be inside the
637  // outer loop. LICM pass can help to promote the runtime check out if the
638  // checked value is loop invariant.
640  }
641 
643  }
644 
645  // After vectorization and unrolling, assume intrinsics may tell us more
646  // about pointer alignments.
648 
649  if (IsFullLTO)
651 }
652 
655  // Whether this is a default or *LTO pre-link pipeline. The FullLTO post-link
656  // is handled separately, so just check this is not the ThinLTO post-link.
657  bool DefaultOrPreLinkPipeline = !PerformThinLTO;
658 
660 
661  if (!PGOSampleUse.empty()) {
662  MPM.add(createPruneEHPass());
663  // In ThinLTO mode, when flattened profile is used, all the available
664  // profile information will be annotated in PreLink phase so there is
665  // no need to load the profile again in PostLink.
668  }
669 
670  // Allow forcing function attributes as a debugging and tuning aid.
672 
673  // If all optimizations are disabled, just run the always-inline pass and,
674  // if enabled, the function merging pass.
675  if (OptLevel == 0) {
676  addPGOInstrPasses(MPM);
677  if (Inliner) {
678  MPM.add(Inliner);
679  Inliner = nullptr;
680  }
681 
682  // FIXME: The BarrierNoopPass is a HACK! The inliner pass above implicitly
683  // creates a CGSCC pass manager, but we don't want to add extensions into
684  // that pass manager. To prevent this we insert a no-op module pass to reset
685  // the pass manager to get the same behavior as EP_OptimizerLast in non-O0
686  // builds. The function merging pass is
687  if (MergeFunctions)
689  else if (GlobalExtensionsNotEmpty() || !Extensions.empty())
690  MPM.add(createBarrierNoopPass());
691 
692  if (PerformThinLTO) {
693  MPM.add(createLowerTypeTestsPass(nullptr, nullptr, true));
694  // Drop available_externally and unreferenced globals. This is necessary
695  // with ThinLTO in order to avoid leaving undefined references to dead
696  // globals in the object file.
698  MPM.add(createGlobalDCEPass());
699  }
700 
701  addExtensionsToPM(EP_EnabledOnOptLevel0, MPM);
702 
705  // Rename anon globals to be able to export them in the summary.
706  // This has to be done after we add the extensions to the pass manager
707  // as there could be passes (e.g. Adddress sanitizer) which introduce
708  // new unnamed globals.
710  }
711 
713  return;
714  }
715 
716  // Add LibraryInfo if we have some.
717  if (LibraryInfo)
719 
720  addInitialAliasAnalysisPasses(MPM);
721 
722  // For ThinLTO there are two passes of indirect call promotion. The
723  // first is during the compile phase when PerformThinLTO=false and
724  // intra-module indirect call targets are promoted. The second is during
725  // the ThinLTO backend when PerformThinLTO=true, when we promote imported
726  // inter-module indirect calls. For that we perform indirect call promotion
727  // earlier in the pass pipeline, here before globalopt. Otherwise imported
728  // available_externally functions look unreferenced and are removed.
729  if (PerformThinLTO) {
730  MPM.add(createPGOIndirectCallPromotionLegacyPass(/*InLTO = */ true,
731  !PGOSampleUse.empty()));
732  MPM.add(createLowerTypeTestsPass(nullptr, nullptr, true));
733  }
734 
735  // For SamplePGO in ThinLTO compile phase, we do not want to unroll loops
736  // as it will change the CFG too much to make the 2nd profile annotation
737  // in backend more difficult.
738  bool PrepareForThinLTOUsingPGOSampleProfile =
739  PrepareForThinLTO && !PGOSampleUse.empty();
740  if (PrepareForThinLTOUsingPGOSampleProfile)
741  DisableUnrollLoops = true;
742 
743  // Infer attributes about declarations if possible.
745 
746  // Infer attributes on declarations, call sites, arguments, etc.
749 
750  addExtensionsToPM(EP_ModuleOptimizerEarly, MPM);
751 
752  if (OptLevel > 2)
754 
755  // Propage constant function arguments by specializing the functions.
758 
759  MPM.add(createIPSCCPPass()); // IP SCCP
761 
762  MPM.add(createGlobalOptimizerPass()); // Optimize out global vars
763  // Promote any localized global vars.
765 
766  MPM.add(createDeadArgEliminationPass()); // Dead argument elimination
767 
768  MPM.add(createInstructionCombiningPass()); // Clean up after IPCP & DAE
769  addExtensionsToPM(EP_Peephole, MPM);
770  MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE
771 
772  // For SamplePGO in ThinLTO compile phase, we do not want to do indirect
773  // call promotion as it will change the CFG too much to make the 2nd
774  // profile annotation in backend more difficult.
775  // PGO instrumentation is added during the compile phase for ThinLTO, do
776  // not run it a second time
777  if (DefaultOrPreLinkPipeline && !PrepareForThinLTOUsingPGOSampleProfile)
778  addPGOInstrPasses(MPM);
779 
780  // Create profile COMDAT variables. Lld linker wants to see all variables
781  // before the LTO/ThinLTO link since it needs to resolve symbols/comdats.
784 
785  // We add a module alias analysis pass here. In part due to bugs in the
786  // analysis infrastructure this "works" in that the analysis stays alive
787  // for the entire SCC pass run below.
789 
790  // Start of CallGraph SCC passes.
791  MPM.add(createPruneEHPass()); // Remove dead EH info
792  bool RunInliner = false;
793  if (Inliner) {
794  MPM.add(Inliner);
795  Inliner = nullptr;
796  RunInliner = true;
797  }
798 
799  // Infer attributes on declarations, call sites, arguments, etc. for an SCC.
802 
803  // Try to perform OpenMP specific optimizations. This is a (quick!) no-op if
804  // there are no OpenMP runtime calls present in the module.
805  if (OptLevel > 1)
807 
809  if (OptLevel > 2)
810  MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args
811 
812  addExtensionsToPM(EP_CGSCCOptimizerLate, MPM);
813  addFunctionSimplificationPasses(MPM);
814 
815  // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC
816  // pass manager that we are specifically trying to avoid. To prevent this
817  // we must insert a no-op module pass to reset the pass manager.
818  MPM.add(createBarrierNoopPass());
819 
820  if (RunPartialInlining)
822 
823  if (OptLevel > 1 && !PrepareForLTO && !PrepareForThinLTO)
824  // Remove avail extern fns and globals definitions if we aren't
825  // compiling an object file for later LTO. For LTO we want to preserve
826  // these so they are eligible for inlining at link-time. Note if they
827  // are unreferenced they will be removed by GlobalDCE later, so
828  // this only impacts referenced available externally globals.
829  // Eventually they will be suppressed during codegen, but eliminating
830  // here enables more opportunity for GlobalDCE as it may make
831  // globals referenced by available external functions dead
832  // and saves running remaining passes on the eliminated functions.
834 
835  // CSFDO instrumentation and use pass. Don't invoke this for Prepare pass
836  // for LTO and ThinLTO -- The actual pass will be called after all inlines
837  // are performed.
838  // Need to do this after COMDAT variables have been eliminated,
839  // (i.e. after EliminateAvailableExternallyPass).
841  addPGOInstrPasses(MPM, /* IsCS */ true);
842 
845 
847 
848  // The inliner performs some kind of dead code elimination as it goes,
849  // but there are cases that are not really caught by it. We might
850  // at some point consider teaching the inliner about them, but it
851  // is OK for now to run GlobalOpt + GlobalDCE in tandem as their
852  // benefits generally outweight the cost, making the whole pipeline
853  // faster.
854  if (RunInliner) {
856  MPM.add(createGlobalDCEPass());
857  }
858 
859  // If we are planning to perform ThinLTO later, let's not bloat the code with
860  // unrolling/vectorization/... now. We'll first run the inliner + CGSCC passes
861  // during ThinLTO and perform the rest of the optimizations afterward.
862  if (PrepareForThinLTO) {
863  // Ensure we perform any last passes, but do so before renaming anonymous
864  // globals in case the passes add any.
865  addExtensionsToPM(EP_OptimizerLast, MPM);
867  // Rename anon globals to be able to export them in the summary.
869  return;
870  }
871 
872  if (PerformThinLTO)
873  // Optimize globals now when performing ThinLTO, this enables more
874  // optimizations later.
876 
877  // Scheduling LoopVersioningLICM when inlining is over, because after that
878  // we may see more accurate aliasing. Reason to run this late is that too
879  // early versioning may prevent further inlining due to increase of code
880  // size. By placing it just after inlining other optimizations which runs
881  // later might get benefit of no-alias assumption in clone loop.
882  if (UseLoopVersioningLICM) {
883  MPM.add(createLoopVersioningLICMPass()); // Do LoopVersioningLICM
885  }
886 
887  // We add a fresh GlobalsModRef run at this point. This is particularly
888  // useful as the above will have inlined, DCE'ed, and function-attr
889  // propagated everything. We should at this point have a reasonably minimal
890  // and richly annotated call graph. By computing aliasing and mod/ref
891  // information for all local globals here, the late loop passes and notably
892  // the vectorizer will be able to use them to help recognize vectorizable
893  // memory operations.
894  //
895  // Note that this relies on a bug in the pass manager which preserves
896  // a module analysis into a function pass pipeline (and throughout it) so
897  // long as the first function pass doesn't invalidate the module analysis.
898  // Thus both Float2Int and LoopRotate have to preserve AliasAnalysis for
899  // this to work. Fortunately, it is trivial to preserve AliasAnalysis
900  // (doing nothing preserves it as it is required to be conservatively
901  // correct in the face of IR changes).
903 
904  MPM.add(createFloat2IntPass());
906 
907  if (EnableMatrix) {
909  // CSE the pointer arithmetic of the column vectors. This allows alias
910  // analysis to establish no-aliasing between loads and stores of different
911  // columns of the same matrix.
912  MPM.add(createEarlyCSEPass(false));
913  }
914 
915  addExtensionsToPM(EP_VectorizerStart, MPM);
916 
917  // Re-rotate loops in all our loop nests. These may have fallout out of
918  // rotated form due to GVN or other transformations, and the vectorizer relies
919  // on the rotated form. Disable header duplication at -Oz.
920  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, PrepareForLTO));
921 
922  // Distribute loops to allow partial vectorization. I.e. isolate dependences
923  // into separate loop that would otherwise inhibit vectorization. This is
924  // currently only performed for loops marked with the metadata
925  // llvm.loop.distribute=true or when -enable-loop-distribute is specified.
927 
928  addVectorPasses(MPM, /* IsFullLTO */ false);
929 
930  // FIXME: We shouldn't bother with this anymore.
931  MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes
932 
933  // GlobalOpt already deletes dead functions and globals, at -O2 try a
934  // late pass of GlobalDCE. It is capable of deleting dead cycles.
935  if (OptLevel > 1) {
936  MPM.add(createGlobalDCEPass()); // Remove dead fns and globals.
937  MPM.add(createConstantMergePass()); // Merge dup global constants
938  }
939 
940  // See comment in the new PM for justification of scheduling splitting at
941  // this stage (\ref buildModuleSimplificationPipeline).
944 
945  if (EnableIROutliner)
946  MPM.add(createIROutlinerPass());
947 
948  if (MergeFunctions)
950 
951  // Add Module flag "CG Profile" based on Branch Frequency Information.
952  if (CallGraphProfile)
954 
955  // LoopSink pass sinks instructions hoisted by LICM, which serves as a
956  // canonicalization pass that enables other optimizations. As a result,
957  // LoopSink pass needs to be a very late IR pass to avoid undoing LICM
958  // result too early.
959  MPM.add(createLoopSinkPass());
960  // Get rid of LCSSA nodes.
962 
963  // This hoists/decomposes div/rem ops. It should run after other sink/hoist
964  // passes to avoid re-sinking, but before SimplifyCFG because it can allow
965  // flattening of blocks.
966  MPM.add(createDivRemPairsPass());
967 
968  // LoopSink (and other loop passes since the last simplifyCFG) might have
969  // resulted in single-entry-single-exit or empty blocks. Clean up the CFG.
971 
972  addExtensionsToPM(EP_OptimizerLast, MPM);
973 
974  if (PrepareForLTO) {
976  // Rename anon globals to be able to handle them in the summary
978  }
979 
981 }
982 
983 void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
984  // Load sample profile before running the LTO optimization pipeline.
985  if (!PGOSampleUse.empty()) {
986  PM.add(createPruneEHPass());
988  }
989 
990  // Remove unused virtual tables to improve the quality of code generated by
991  // whole-program devirtualization and bitset lowering.
992  PM.add(createGlobalDCEPass());
993 
994  // Provide AliasAnalysis services for optimizations.
995  addInitialAliasAnalysisPasses(PM);
996 
997  // Allow forcing function attributes as a debugging and tuning aid.
999 
1000  // Infer attributes about declarations if possible.
1002 
1003  if (OptLevel > 1) {
1004  // Split call-site with more constrained arguments.
1006 
1007  // Indirect call promotion. This should promote all the targets that are
1008  // left by the earlier promotion pass that promotes intra-module targets.
1009  // This two-step promotion is to save the compile time. For LTO, it should
1010  // produce the same result as if we only do promotion here.
1011  PM.add(
1013 
1014  // Propage constant function arguments by specializing the functions.
1017 
1018  // Propagate constants at call sites into the functions they call. This
1019  // opens opportunities for globalopt (and inlining) by substituting function
1020  // pointers passed as arguments to direct uses of functions.
1021  PM.add(createIPSCCPPass());
1022 
1023  // Attach metadata to indirect call sites indicating the set of functions
1024  // they may target at run-time. This should follow IPSCCP.
1026 
1027  // Infer attributes on declarations, call sites, arguments, etc.
1030  }
1031 
1032  // Infer attributes about definitions. The readnone attribute in particular is
1033  // required for virtual constant propagation.
1036 
1037  // Split globals using inrange annotations on GEP indices. This can help
1038  // improve the quality of generated code when virtual constant propagation or
1039  // control flow integrity are enabled.
1040  PM.add(createGlobalSplitPass());
1041 
1042  // Apply whole-program devirtualization and virtual constant propagation.
1044 
1045  // That's all we need at opt level 1.
1046  if (OptLevel == 1)
1047  return;
1048 
1049  // Now that we internalized some globals, see if we can hack on them!
1051  // Promote any localized global vars.
1053 
1054  // Linking modules together can lead to duplicated global constants, only
1055  // keep one copy of each constant.
1057 
1058  // Remove unused arguments from functions.
1060 
1061  // Reduce the code after globalopt and ipsccp. Both can open up significant
1062  // simplification opportunities, and both can propagate functions through
1063  // function pointers. When this happens, we often have to resolve varargs
1064  // calls, etc, so let instcombine do this.
1065  if (OptLevel > 2)
1068  addExtensionsToPM(EP_Peephole, PM);
1069 
1070  // Inline small functions
1071  bool RunInliner = Inliner;
1072  if (RunInliner) {
1073  PM.add(Inliner);
1074  Inliner = nullptr;
1075  }
1076 
1077  PM.add(createPruneEHPass()); // Remove dead EH info.
1078 
1079  // CSFDO instrumentation and use pass.
1080  addPGOInstrPasses(PM, /* IsCS */ true);
1081 
1082  // Infer attributes on declarations, call sites, arguments, etc. for an SCC.
1085 
1086  // Try to perform OpenMP specific optimizations. This is a (quick!) no-op if
1087  // there are no OpenMP runtime calls present in the module.
1088  if (OptLevel > 1)
1090 
1091  // Optimize globals again if we ran the inliner.
1092  if (RunInliner)
1094  PM.add(createGlobalDCEPass()); // Remove dead functions.
1095 
1096  // If we didn't decide to inline a function, check to see if we can
1097  // transform it to pass arguments by value instead of by reference.
1099 
1100  // The IPO passes may leave cruft around. Clean up after them.
1102  addExtensionsToPM(EP_Peephole, PM);
1103  PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true));
1104 
1105  // Break up allocas
1106  PM.add(createSROAPass());
1107 
1108  // LTO provides additional opportunities for tailcall elimination due to
1109  // link-time inlining, and visibility of nocapture attribute.
1110  if (OptLevel > 1)
1112 
1113  // Infer attributes on declarations, call sites, arguments, etc.
1114  PM.add(createPostOrderFunctionAttrsLegacyPass()); // Add nocapture.
1115  // Run a few AA driven optimizations here and now, to cleanup the code.
1116  PM.add(createGlobalsAAWrapperPass()); // IP alias analysis.
1117 
1119  PM.add(NewGVN ? createNewGVNPass()
1120  : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies.
1121  PM.add(createMemCpyOptPass()); // Remove dead memcpys.
1122 
1123  // Nuke dead stores.
1125  PM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds.
1126 
1127  // More loops are countable; try to optimize them.
1128  if (EnableLoopFlatten)
1129  PM.add(createLoopFlattenPass());
1134 
1137 
1138  // Unroll small loops and perform peeling.
1142 
1143  addVectorPasses(PM, /* IsFullLTO */ true);
1144 
1145  addExtensionsToPM(EP_Peephole, PM);
1146 
1147  PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true));
1148 }
1149 
1150 void PassManagerBuilder::addLateLTOOptimizationPasses(
1152  // See comment in the new PM for justification of scheduling splitting at
1153  // this stage (\ref buildLTODefaultPipeline).
1154  if (EnableHotColdSplit)
1156 
1157  // Delete basic blocks, which optimization passes may have killed.
1158  PM.add(
1159  createCFGSimplificationPass(SimplifyCFGOptions().hoistCommonInsts(true)));
1160 
1161  // Drop bodies of available externally objects to improve GlobalDCE.
1163 
1164  // Now that we have optimized the program, discard unreachable functions.
1165  PM.add(createGlobalDCEPass());
1166 
1167  // FIXME: this is profitable (for compiler time) to do at -O0 too, but
1168  // currently it damages debug info.
1169  if (MergeFunctions)
1171 }
1172 
1175  PerformThinLTO = true;
1176  if (LibraryInfo)
1178 
1179  if (VerifyInput)
1180  PM.add(createVerifierPass());
1181 
1182  if (ImportSummary) {
1183  // This pass imports type identifier resolutions for whole-program
1184  // devirtualization and CFI. It must run early because other passes may
1185  // disturb the specific instruction patterns that these passes look for,
1186  // creating dependencies on resolutions that may not appear in the summary.
1187  //
1188  // For example, GVN may transform the pattern assume(type.test) appearing in
1189  // two basic blocks into assume(phi(type.test, type.test)), which would
1190  // transform a dependency on a WPD resolution into a dependency on a type
1191  // identifier resolution for CFI.
1192  //
1193  // Also, WPD has access to more precise information than ICP and can
1194  // devirtualize more effectively, so it should operate on the IR first.
1197  }
1198 
1200 
1201  if (VerifyOutput)
1202  PM.add(createVerifierPass());
1203  PerformThinLTO = false;
1204 }
1205 
1207  if (LibraryInfo)
1209 
1210  if (VerifyInput)
1211  PM.add(createVerifierPass());
1212 
1213  addExtensionsToPM(EP_FullLinkTimeOptimizationEarly, PM);
1214 
1215  if (OptLevel != 0)
1216  addLTOOptimizationPasses(PM);
1217  else {
1218  // The whole-program-devirt pass needs to run at -O0 because only it knows
1219  // about the llvm.type.checked.load intrinsic: it needs to both lower the
1220  // intrinsic itself and handle it in the summary.
1222  }
1223 
1224  // Create a function that performs CFI checks for cross-DSO calls with targets
1225  // in the current module.
1226  PM.add(createCrossDSOCFIPass());
1227 
1228  // Lower type metadata and the type.test intrinsic. This pass supports Clang's
1229  // control flow integrity mechanisms (-fsanitize=cfi*) and needs to run at
1230  // link time if CFI is enabled. The pass does nothing if CFI is disabled.
1232  // Run a second time to clean up any type tests left behind by WPD for use
1233  // in ICP (which is performed earlier than this in the regular LTO pipeline).
1234  PM.add(createLowerTypeTestsPass(nullptr, nullptr, true));
1235 
1236  if (OptLevel != 0)
1237  addLateLTOOptimizationPasses(PM);
1238 
1239  addExtensionsToPM(EP_FullLinkTimeOptimizationLast, PM);
1240 
1242 
1243  if (VerifyOutput)
1244  PM.add(createVerifierPass());
1245 }
1246 
1249  return wrap(PMB);
1250 }
1251 
1254  delete Builder;
1255 }
1256 
1257 void
1259  unsigned OptLevel) {
1261  Builder->OptLevel = OptLevel;
1262 }
1263 
1264 void
1266  unsigned SizeLevel) {
1268  Builder->SizeLevel = SizeLevel;
1269 }
1270 
1271 void
1273  LLVMBool Value) {
1274  // NOTE: The DisableUnitAtATime switch has been removed.
1275 }
1276 
1277 void
1279  LLVMBool Value) {
1281  Builder->DisableUnrollLoops = Value;
1282 }
1283 
1284 void
1286  LLVMBool Value) {
1287  // NOTE: The simplify-libcalls pass has been removed.
1288 }
1289 
1290 void
1292  unsigned Threshold) {
1295 }
1296 
1297 void
1299  LLVMPassManagerRef PM) {
1301  legacy::FunctionPassManager *FPM = unwrap<legacy::FunctionPassManager>(PM);
1302  Builder->populateFunctionPassManager(*FPM);
1303 }
1304 
1305 void
1307  LLVMPassManagerRef PM) {
1310  Builder->populateModulePassManager(*MPM);
1311 }
1312 
1314  LLVMPassManagerRef PM,
1315  LLVMBool Internalize,
1316  LLVMBool RunInliner) {
1318  legacy::PassManagerBase *LPM = unwrap(PM);
1319 
1320  // A small backwards compatibility hack. populateLTOPassManager used to take
1321  // an RunInliner option.
1322  if (RunInliner && !Builder->Inliner)
1323  Builder->Inliner = createFunctionInliningPass();
1324 
1325  Builder->populateLTOPassManager(*LPM);
1326 }
llvm::createInstrProfilingLegacyPass
ModulePass * createInstrProfilingLegacyPass(const InstrProfOptions &Options=InstrProfOptions(), bool IsCS=false)
Insert frontend instrumentation based profiling. Parameter IsCS indicates if.
Definition: InstrProfiling.cpp:433
llvm::PassManagerBuilder::LicmMssaOptCap
unsigned LicmMssaOptCap
Definition: PassManagerBuilder.h:173
i
i
Definition: README.txt:29
llvm::createLoopLoadEliminationPass
FunctionPass * createLoopLoadEliminationPass()
Definition: LoopLoadElimination.cpp:703
llvm::PassManagerBuilder::EP_OptimizerLast
@ EP_OptimizerLast
EP_OptimizerLast – This extension point allows adding passes that run after everything else.
Definition: PassManagerBuilder.h:89
llvm::createAssumeSimplifyPass
FunctionPass * createAssumeSimplifyPass()
Definition: AssumeBundleBuilder.cpp:605
TypeBasedAliasAnalysis.h
Instrumentation.h
llvm::createMergedLoadStoreMotionPass
FunctionPass * createMergedLoadStoreMotionPass(bool SplitFooterBB=false)
createMergedLoadStoreMotionPass - The public interface to this file.
Definition: MergedLoadStoreMotion.cpp:401
llvm::createSimpleLoopUnswitchLegacyPass
Pass * createSimpleLoopUnswitchLegacyPass(bool NonTrivial=false)
Create the legacy pass object for the simple loop unswitcher.
Definition: SimpleLoopUnswitch.cpp:3233
llvm::RunNewGVN
cl::opt< bool > RunNewGVN
llvm::createGVNSinkPass
FunctionPass * createGVNSinkPass()
Definition: GVNSink.cpp:927
llvm::PassManagerBuilder::PGOSampleUse
std::string PGOSampleUse
Path of the sample Profile data file.
Definition: PassManagerBuilder.h:187
LLVMPassManagerBuilderPopulateFunctionPassManager
void LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)
See llvm::PassManagerBuilder::populateFunctionPassManager.
Definition: PassManagerBuilder.cpp:1298
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::createTailCallEliminationPass
FunctionPass * createTailCallEliminationPass()
Definition: TailRecursionElimination.cpp:920
llvm::createCrossDSOCFIPass
ModulePass * createCrossDSOCFIPass()
This pass export CFI checks for use by external modules.
llvm::PassManagerBuilder::PassManagerBuilder
PassManagerBuilder()
Definition: PassManagerBuilder.cpp:194
llvm::createCFLAndersAAWrapperPass
ImmutablePass * createCFLAndersAAWrapperPass()
llvm::EnableHotColdSplit
cl::opt< bool > EnableHotColdSplit
Scalar.h
llvm::createLowerTypeTestsPass
ModulePass * createLowerTypeTestsPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary, bool DropTypeTests=false)
This pass lowers type metadata and the llvm.type.test intrinsic to bitsets.
llvm::PassManagerBuilder::VerifyOutput
bool VerifyOutput
Definition: PassManagerBuilder.h:167
llvm::ExtraVectorizerPasses
cl::opt< bool > ExtraVectorizerPasses
llvm::EnableConstraintElimination
cl::opt< bool > EnableConstraintElimination
llvm::ALL
@ ALL
Definition: Attributor.h:4619
llvm::createCFGSimplificationPass
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
Definition: SimplifyCFGPass.cpp:415
llvm::SetLicmMssaNoAccForPromotionCap
cl::opt< unsigned > SetLicmMssaNoAccForPromotionCap
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::createLoopSimplifyCFGPass
Pass * createLoopSimplifyCFGPass()
Definition: LoopSimplifyCFG.cpp:764
llvm::createPruneEHPass
Pass * createPruneEHPass()
createPruneEHPass - Return a new pass object which transforms invoke instructions into calls,...
Definition: PruneEH.cpp:63
llvm::PassManagerBuilder::populateLTOPassManager
void populateLTOPassManager(legacy::PassManagerBase &PM)
Definition: PassManagerBuilder.cpp:1206
llvm::RunPartialInlining
cl::opt< bool > RunPartialInlining
SCCP.h
ManagedStatic.h
llvm::PassManagerBuilder::LoopVectorize
bool LoopVectorize
Definition: PassManagerBuilder.h:160
CGPassBuilderOption.h
llvm::createPGOInstrumentationUseLegacyPass
ModulePass * createPGOInstrumentationUseLegacyPass(StringRef Filename=StringRef(""), bool IsCS=false)
Definition: PGOInstrumentation.cpp:503
GlobalsModRef.h
llvm::createEarlyCSEPass
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1729
VectorCombine.h
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::createSampleProfileLoaderPass
ModulePass * createSampleProfileLoaderPass()
Definition: SampleProfile.cpp:1885
llvm::createDeadArgEliminationPass
ModulePass * createDeadArgEliminationPass()
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the b...
llvm::PassManagerBuilder::DisableGVNLoadPRE
bool DisableGVNLoadPRE
Definition: PassManagerBuilder.h:164
LLVMPassManagerBuilderSetDisableSimplifyLibCalls
void LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableSimplifyLibCalls.
Definition: PassManagerBuilder.cpp:1285
llvm::PassManagerBuilder::ImportSummary
const ModuleSummaryIndex * ImportSummary
The module summary index to use for importing information to the thin LTO backends,...
Definition: PassManagerBuilder.h:155
llvm::createVectorCombinePass
Pass * createVectorCombinePass()
Definition: VectorCombine.cpp:1113
llvm::createCFLSteensAAWrapperPass
ImmutablePass * createCFLSteensAAWrapperPass()
llvm::createLoopIdiomPass
Pass * createLoopIdiomPass()
Definition: LoopIdiomRecognize.cpp:346
llvm::PassManagerBuilder::PerformThinLTO
bool PerformThinLTO
Definition: PassManagerBuilder.h:171
llvm::CFLAAType::Andersen
@ Andersen
llvm::createDeadStoreEliminationPass
FunctionPass * createDeadStoreEliminationPass()
Definition: DeadStoreElimination.cpp:2198
llvm::PassManagerBuilder::ExtensionPointTy
ExtensionPointTy
Definition: PassManagerBuilder.h:68
llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll
bool ForgetAllSCEVInLoopUnroll
Definition: PassManagerBuilder.h:165
LLVMPassManagerBuilderDispose
void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB)
Definition: PassManagerBuilder.cpp:1252
llvm::createPGOIndirectCallPromotionLegacyPass
ModulePass * createPGOIndirectCallPromotionLegacyPass(bool InLTO=false, bool SamplePGO=false)
Definition: IndirectCallPromotion.cpp:160
llvm::UseCFLAA
static cl::opt<::CFLAAType > UseCFLAA("use-cfl-aa", cl::init(::CFLAAType::None), cl::Hidden, cl::desc("Enable the new, experimental CFL alias analysis"), cl::values(clEnumValN(::CFLAAType::None, "none", "Disable CFL-AA"), clEnumValN(::CFLAAType::Steensgaard, "steens", "Enable unification-based CFL-AA"), clEnumValN(::CFLAAType::Andersen, "anders", "Enable inclusion-based CFL-AA"), clEnumValN(::CFLAAType::Both, "both", "Enable both variants of CFL-AA")))
llvm::EnableKnowledgeRetention
cl::opt< bool > EnableKnowledgeRetention
enable preservation of attributes in assume like: call void @llvm.assume(i1 true) [ "nonnull"(i32* PT...
Definition: InstCombineCalls.cpp:98
llvm::InlineParams
Thresholds to tune inline cost analysis.
Definition: InlineCost.h:185
llvm::createBarrierNoopPass
ModulePass * createBarrierNoopPass()
createBarrierNoopPass - This pass is purely a module pass barrier in a pass manager.
Definition: BarrierNoopPass.cpp:43
llvm::createMemCpyOptPass
FunctionPass * createMemCpyOptPass()
The public interface to this file...
Definition: MemCpyOptimizer.cpp:297
llvm::createMergeFunctionsPass
ModulePass * createMergeFunctionsPass()
createMergeFunctionsPass - This pass discovers identical functions and collapses them.
llvm::PassManagerBuilder::ExportSummary
ModuleSummaryIndex * ExportSummary
The module summary index to use for exporting information from the regular LTO phase,...
Definition: PassManagerBuilder.h:150
llvm::EnableOrderFileInstrumentation
cl::opt< bool > EnableOrderFileInstrumentation
llvm::CFLAAType::Both
@ Both
llvm::createGVNPass
FunctionPass * createGVNPass(bool NoMemDepAnalysis=false)
Create a legacy GVN pass.
Definition: GVN.cpp:3115
llvm::EnableMatrix
cl::opt< bool > EnableMatrix
llvm::createAttributorLegacyPass
Pass * createAttributorLegacyPass()
Definition: Attributor.cpp:3062
STLExtras.h
llvm::createCGProfileLegacyPass
ModulePass * createCGProfileLegacyPass()
llvm::createCallSiteSplittingPass
FunctionPass * createCallSiteSplittingPass()
Definition: CallSiteSplitting.cpp:574
BasicAliasAnalysis.h
LegacyPassManager.h
PassManagerBuilder.h
llvm::createInferFunctionAttrsLegacyPass
Pass * createInferFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to infer function attributes.
Definition: InferFunctionAttrs.cpp:90
llvm::createNameAnonGlobalPass
ModulePass * createNameAnonGlobalPass()
===------------------------------------------------------------------—===//
Definition: NameAnonGlobals.cpp:117
llvm::createControlHeightReductionLegacyPass
FunctionPass * createControlHeightReductionLegacyPass()
Definition: ControlHeightReduction.cpp:141
llvm::createStripDeadPrototypesPass
ModulePass * createStripDeadPrototypesPass()
createStripDeadPrototypesPass - This pass removes any function declarations (prototypes) that are not...
llvm::PassManagerBuilder::EP_LoopOptimizerEnd
@ EP_LoopOptimizerEnd
EP_LoopOptimizerEnd - This extension point allows adding loop passes to the end of the loop optimizer...
Definition: PassManagerBuilder.h:80
llvm::createAttributorCGSCCLegacyPass
Pass * createAttributorCGSCCLegacyPass()
Definition: Attributor.cpp:3063
llvm::createFloat2IntPass
FunctionPass * createFloat2IntPass()
Definition: Float2Int.cpp:539
llvm::createDivRemPairsPass
FunctionPass * createDivRemPairsPass()
Definition: DivRemPairs.cpp:429
llvm::createSLPVectorizerPass
Pass * createSLPVectorizerPass()
Definition: SLPVectorizer.cpp:9395
CommandLine.h
llvm::PassManagerBuilder::PGOInstrGen
std::string PGOInstrGen
Profile data file name that the instrumentation will be written to.
Definition: PassManagerBuilder.h:183
llvm::MODULE
@ MODULE
Definition: Attributor.h:4617
GlobalExtensions
static ManagedStatic< SmallVector< std::tuple< PassManagerBuilder::ExtensionPointTy, PassManagerBuilder::ExtensionFn, PassManagerBuilder::GlobalExtensionID >, 8 > > GlobalExtensions
Set of global extensions, automatically added as part of the standard set.
Definition: PassManagerBuilder.cpp:236
llvm::createLoopUnswitchPass
Pass * createLoopUnswitchPass(bool OptimizeForSize=false, bool hasBranchDivergence=false)
Definition: LoopUnswitch.cpp:410
LLVMPassManagerBuilderPopulateLTOPassManager
void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM, LLVMBool Internalize, LLVMBool RunInliner)
See llvm::PassManagerBuilder::populateLTOPassManager.
Definition: PassManagerBuilder.cpp:1313
llvm::createForceFunctionAttrsLegacyPass
Pass * createForceFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to force function attrs.
llvm::createDFAJumpThreadingPass
FunctionPass * createDFAJumpThreadingPass()
Definition: DFAJumpThreading.cpp:206
llvm::FlattenedProfileUsed
cl::opt< bool > FlattenedProfileUsed
llvm::PassManagerBuilder::NewGVN
bool NewGVN
Definition: PassManagerBuilder.h:163
llvm::createLoopSinkPass
Pass * createLoopSinkPass()
llvm::PassManagerBuilder::addGlobalExtension
static GlobalExtensionID addGlobalExtension(ExtensionPointTy Ty, ExtensionFn Fn)
Adds an extension that will be used by all PassManagerBuilder instances.
Definition: PassManagerBuilder.cpp:247
llvm::createLoopInterchangePass
Pass * createLoopInterchangePass()
Definition: LoopInterchange.cpp:1810
llvm::createCanonicalizeAliasesPass
ModulePass * createCanonicalizeAliasesPass()
Definition: CanonicalizeAliases.cpp:102
llvm::PassManagerBuilder::LibraryInfo
TargetLibraryInfoImpl * LibraryInfo
LibraryInfo - Specifies information about the runtime library for the optimizer.
Definition: PassManagerBuilder.h:141
llvm::createWholeProgramDevirtPass
ModulePass * createWholeProgramDevirtPass(ModuleSummaryIndex *ExportSummary, const ModuleSummaryIndex *ImportSummary)
This pass implements whole-program devirtualization using type metadata.
Definition: WholeProgramDevirt.cpp:753
llvm::createLowerMatrixIntrinsicsPass
Pass * createLowerMatrixIntrinsicsPass()
Definition: LowerMatrixIntrinsics.cpp:2321
llvm::EnableSimpleLoopUnswitch
static cl::opt< bool > EnableSimpleLoopUnswitch("enable-simple-loop-unswitch", cl::init(false), cl::Hidden, cl::desc("Enable the simple loop unswitch pass. Also enables independent " "cleanup passes integrated into the loop pass manager pipeline."))
llvm::createLoopVersioningLICMPass
Pass * createLoopVersioningLICMPass()
Definition: LoopVersioningLICM.cpp:660
llvm::createGlobalSplitPass
ModulePass * createGlobalSplitPass()
This pass splits globals into pieces for the benefit of whole-program devirtualization and control-fl...
Definition: GlobalSplit.cpp:188
llvm::createNewGVNPass
FunctionPass * createNewGVNPass()
Definition: NewGVN.cpp:4207
llvm::createPGOInstrumentationGenCreateVarLegacyPass
ModulePass * createPGOInstrumentationGenCreateVarLegacyPass(StringRef CSInstrName=StringRef(""))
llvm::ManagedStatic
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83
IP
Definition: NVPTXLowerArgs.cpp:166
TargetLibraryInfo.h
llvm::DisableLibCallsShrinkWrap
static cl::opt< bool > DisableLibCallsShrinkWrap("disable-libcalls-shrinkwrap", cl::init(false), cl::Hidden, cl::desc("Disable shrink-wrap library calls"))
GlobalExtensionsCounter
static PassManagerBuilder::GlobalExtensionID GlobalExtensionsCounter
Definition: PassManagerBuilder.cpp:237
llvm::DisablePreInliner
cl::opt< bool > DisablePreInliner
llvm::createLibCallsShrinkWrapPass
FunctionPass * createLibCallsShrinkWrapPass()
Definition: LibCallsShrinkWrap.cpp:547
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:256
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::PassManagerBuilder::PrepareForThinLTO
bool PrepareForThinLTO
Definition: PassManagerBuilder.h:170
llvm::PassManagerBuilder::Inliner
Pass * Inliner
Inliner - Specifies the inliner to use.
Definition: PassManagerBuilder.h:145
llvm::PassManagerBuilder::MergeFunctions
bool MergeFunctions
Definition: PassManagerBuilder.h:168
llvm::createIndVarSimplifyPass
Pass * createIndVarSimplifyPass()
Definition: IndVarSimplify.cpp:1990
GVN.h
llvm::createAnnotationRemarksLegacyPass
FunctionPass * createAnnotationRemarksLegacyPass()
Definition: AnnotationRemarks.cpp:120
llvm::createGlobalOptimizerPass
ModulePass * createGlobalOptimizerPass()
createGlobalOptimizerPass - This function returns a new pass that optimizes non-address taken interna...
Definition: GlobalOpt.cpp:2768
llvm::createLoopDistributePass
FunctionPass * createLoopDistributePass()
llvm::createPGOMemOPSizeOptLegacyPass
FunctionPass * createPGOMemOPSizeOptLegacyPass()
llvm::PreInlineThreshold
cl::opt< int > PreInlineThreshold
llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap
unsigned LicmMssaNoAccForPromotionCap
Definition: PassManagerBuilder.h:174
CFLAndersAliasAnalysis.h
Utils.h
ScopedNoAliasAA.h
llvm::EnableDFAJumpThreading
cl::opt< bool > EnableDFAJumpThreading
llvm::PassManagerBuilder::LoopsInterleaved
bool LoopsInterleaved
Definition: PassManagerBuilder.h:161
llvm::createHotColdSplittingPass
ModulePass * createHotColdSplittingPass()
createHotColdSplittingPass - This pass outlines cold blocks into a separate function(s).
Definition: HotColdSplitting.cpp:793
InstSimplifyPass.h
llvm::createSimpleLoopUnrollPass
Pass * createSimpleLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false)
Definition: LoopUnrollPass.cpp:1448
llvm::createFunctionInliningPass
Pass * createFunctionInliningPass()
createFunctionInliningPass - Return a new pass object that uses a heuristic to inline direct function...
Definition: InlineSimple.cpp:97
llvm::legacy::PassManagerBase::add
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
llvm::EnablePrepareForThinLTO
static cl::opt< bool > EnablePrepareForThinLTO("prepare-for-thinlto", cl::init(false), cl::Hidden, cl::desc("Enable preparation for ThinLTO."))
LLVMPassManagerBuilderUseInlinerWithThreshold
void LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB, unsigned Threshold)
See llvm::PassManagerBuilder::Inliner.
Definition: PassManagerBuilder.cpp:1291
llvm::PassManagerBuilder
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
Definition: PassManagerBuilder.h:59
llvm::cl::ZeroOrMore
@ ZeroOrMore
Definition: CommandLine.h:120
llvm::createGlobalsAAWrapperPass
ModulePass * createGlobalsAAWrapperPass()
Definition: GlobalsModRef.cpp:1021
llvm::createIPSCCPPass
ModulePass * createIPSCCPPass()
createIPSCCPPass - This pass propagates constants from call sites into the bodies of functions,...
Definition: SCCP.cpp:106
llvm::PassManagerBuilder::~PassManagerBuilder
~PassManagerBuilder()
Definition: PassManagerBuilder.cpp:225
ForceFunctionAttrs.h
llvm::cl::opt< bool >
Attributor.h
llvm::UseGVNAfterVectorization
static cl::opt< bool > UseGVNAfterVectorization("use-gvn-after-vectorization", cl::init(false), cl::Hidden, cl::desc("Run GVN instead of Early CSE after vectorization passes"))
llvm::createLoopRerollPass
Pass * createLoopRerollPass()
Definition: LoopRerollPass.cpp:506
llvm::CFLAAType::None
@ None
llvm::MipsISD::Ext
@ Ext
Definition: MipsISelLowering.h:156
llvm::cl::values
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
Definition: CommandLine.h:699
llvm::createGVNHoistPass
FunctionPass * createGVNHoistPass()
Definition: GVNHoist.cpp:1263
llvm::RunLoopRerolling
static cl::opt< bool > RunLoopRerolling("reroll-loops", cl::Hidden, cl::desc("Run the loop rerolling pass"))
llvm::PassManagerBuilder::EP_ScalarOptimizerLate
@ EP_ScalarOptimizerLate
EP_ScalarOptimizerLate - This extension point allows adding optimization passes after most of the mai...
Definition: PassManagerBuilder.h:85
llvm::TargetLibraryInfoWrapperPass
Definition: TargetLibraryInfo.h:463
llvm::createReversePostOrderFunctionAttrsPass
Pass * createReversePostOrderFunctionAttrsPass()
createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call graph in RPO to deduce and...
Definition: FunctionAttrs.cpp:1731
llvm::createAggressiveInstCombinerPass
FunctionPass * createAggressiveInstCombinerPass()
Definition: AggressiveInstCombine.cpp:461
IPO.h
llvm::createGlobalDCEPass
ModulePass * createGlobalDCEPass()
createGlobalDCEPass - This transform is designed to eliminate unreachable internal globals (functions...
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::PassManagerBuilder::ExtensionFn
std::function< void(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM)> ExtensionFn
Extensions are passed to the builder itself (so they can see how it is configured) as well as the pas...
Definition: PassManagerBuilder.h:65
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
llvm::createLowerExpectIntrinsicPass
FunctionPass * createLowerExpectIntrinsicPass()
LLVMPassManagerBuilderRef
struct LLVMOpaquePassManagerBuilder * LLVMPassManagerBuilderRef
Definition: PassManagerBuilder.h:20
AggressiveInstCombine.h
llvm::PassManagerBuilder::RerollLoops
bool RerollLoops
Definition: PassManagerBuilder.h:162
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:443
llvm::EnableGVNSink
cl::opt< bool > EnableGVNSink
llvm::PassManagerBuilder::OptLevel
unsigned OptLevel
The Optimization Level - Specify the basic optimization level.
Definition: PassManagerBuilder.h:132
llvm::createCorrelatedValuePropagationPass
Pass * createCorrelatedValuePropagationPass()
Definition: CorrelatedValuePropagation.cpp:126
InferFunctionAttrs.h
SimpleLoopUnswitch.h
llvm::createPostOrderFunctionAttrsLegacyPass
Pass * createPostOrderFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to compute function attrs in post-order.
Definition: FunctionAttrs.cpp:1679
llvm::createPGOInstrumentationGenLegacyPass
ModulePass * createPGOInstrumentationGenLegacyPass(bool IsCS=false)
Definition: PGOInstrumentation.cpp:489
llvm::InstrProfOptions
Options for the frontend instrumentation based profiling pass.
Definition: Instrumentation.h:121
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::PassManagerBuilder::PGOInstrUse
std::string PGOInstrUse
Path of the profile data file.
Definition: PassManagerBuilder.h:185
llvm::PassManagerBuilder::GlobalExtensionID
int GlobalExtensionID
Definition: PassManagerBuilder.h:66
InlineCost.h
llvm::PassManagerBuilder::VerifyInput
bool VerifyInput
Definition: PassManagerBuilder.h:166
llvm::createTypeBasedAAWrapperPass
ImmutablePass * createTypeBasedAAWrapperPass()
llvm::EnableIROutliner
cl::opt< bool > EnableIROutliner
llvm::legacy::FunctionPassManager::add
void add(Pass *P) override
Add a pass to the queue of passes to run.
Definition: LegacyPassManager.cpp:1344
llvm::createArgumentPromotionPass
Pass * createArgumentPromotionPass(unsigned maxElements=3)
createArgumentPromotionPass - This pass promotes "by reference" arguments to be passed by value if th...
Definition: ArgumentPromotion.cpp:1102
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:650
llvm::createSCCPPass
FunctionPass * createSCCPPass()
Definition: SCCP.cpp:291
LLVMPassManagerRef
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition: Types.h:127
llvm::CFLAAType::Steensgaard
@ Steensgaard
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:251
llvm::PassManagerBuilder::CallGraphProfile
bool CallGraphProfile
Definition: PassManagerBuilder.h:158
llvm::CGSCC
@ CGSCC
Definition: Attributor.h:4618
llvm::PassManagerBuilder::SLPVectorize
bool SLPVectorize
Definition: PassManagerBuilder.h:159
DataLayout.h
llvm::createIROutlinerPass
ModulePass * createIROutlinerPass()
createIROutlinerPass - This pass finds similar code regions and factors those regions out into functi...
Definition: IROutliner.cpp:2287
llvm::EnableLoopFlatten
cl::opt< bool > EnableLoopFlatten
clEnumValN
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:674
llvm::PassManagerBuilder::EP_Peephole
@ EP_Peephole
EP_Peephole - This extension point allows adding passes that perform peephole optimizations similar t...
Definition: PassManagerBuilder.h:104
llvm::createCalledValuePropagationPass
ModulePass * createCalledValuePropagationPass()
createCalledValuePropagationPass - Attach metadata to indirct call sites indicating the set of functi...
llvm::createVerifierPass
FunctionPass * createVerifierPass(bool FatalErrors=true)
Definition: Verifier.cpp:6242
llvm::createReassociatePass
FunctionPass * createReassociatePass()
llvm::PassManagerBuilder::PrepareForLTO
bool PrepareForLTO
Definition: PassManagerBuilder.h:169
LoopVectorize.h
llvm::find_if
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1578
LLVMPassManagerBuilderSetOptLevel
void LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, unsigned OptLevel)
See llvm::PassManagerBuilder::OptLevel.
Definition: PassManagerBuilder.cpp:1258
llvm::ForgetSCEVInLoopUnroll
cl::opt< bool > ForgetSCEVInLoopUnroll
SLPVectorizer.h
Verifier.h
llvm::createAggressiveDCEPass
FunctionPass * createAggressiveDCEPass()
Definition: ADCE.cpp:752
llvm::PassManagerBuilder::removeGlobalExtension
static void removeGlobalExtension(GlobalExtensionID ExtensionID)
Removes an extension that was previously added using addGlobalExtension.
Definition: PassManagerBuilder.cpp:254
LLVMPassManagerBuilderSetSizeLevel
void LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, unsigned SizeLevel)
See llvm::PassManagerBuilder::SizeLevel.
Definition: PassManagerBuilder.cpp:1265
LLVMBool
int LLVMBool
Definition: Types.h:28
llvm::PassManagerBuilder::EP_VectorizerStart
@ EP_VectorizerStart
EP_VectorizerStart - This extension point allows adding optimization passes before the vectorizer and...
Definition: PassManagerBuilder.h:94
llvm::EnableCHR
cl::opt< bool > EnableCHR
LoopUnrollPass.h
llvm::PassManagerBuilder::EnablePGOInstrGen
bool EnablePGOInstrGen
Enable profile instrumentation pass.
Definition: PassManagerBuilder.h:177
llvm::createScopedNoAliasAAWrapperPass
ImmutablePass * createScopedNoAliasAAWrapperPass()
llvm::createBitTrackingDCEPass
FunctionPass * createBitTrackingDCEPass()
Definition: BDCE.cpp:205
llvm::createAlignmentFromAssumptionsPass
FunctionPass * createAlignmentFromAssumptionsPass()
Definition: AlignmentFromAssumptions.cpp:86
LLVMPassManagerBuilderSetDisableUnitAtATime
void LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableUnitAtATime.
Definition: PassManagerBuilder.cpp:1272
llvm::PassManagerBuilder::populateModulePassManager
void populateModulePassManager(legacy::PassManagerBase &MPM)
populateModulePassManager - This sets up the primary pass manager.
Definition: PassManagerBuilder.cpp:653
llvm::PassManagerBuilder::EP_FullLinkTimeOptimizationLast
@ EP_FullLinkTimeOptimizationLast
EP_FullLinkTimeOptimizationLast - This extensions point allow adding passes that run at Link Time,...
Definition: PassManagerBuilder.h:127
llvm::PassManagerBuilder::EP_ModuleOptimizerEarly
@ EP_ModuleOptimizerEarly
EP_ModuleOptimizerEarly - This extension point allows adding passes just before the main module-level...
Definition: PassManagerBuilder.h:76
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::createLoopRotatePass
Pass * createLoopRotatePass(int MaxHeaderSize=-1, bool PrepareForLTO=false)
Definition: LoopRotation.cpp:153
LLVMPassManagerBuilderSetDisableUnrollLoops
void LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableUnrollLoops.
Definition: PassManagerBuilder.cpp:1278
PassManagerBuilder.h
llvm::PassManagerBuilder::SizeLevel
unsigned SizeLevel
SizeLevel - How much we're optimizing for size.
Definition: PassManagerBuilder.h:136
llvm::createInstSimplifyLegacyPass
FunctionPass * createInstSimplifyLegacyPass()
Definition: InstSimplifyPass.cpp:129
llvm::UseLoopVersioningLICM
static cl::opt< bool > UseLoopVersioningLICM("enable-loop-versioning-licm", cl::init(false), cl::Hidden, cl::desc("Enable the experimental Loop Versioning LICM pass"))
llvm::EnablePerformThinLTO
static cl::opt< bool > EnablePerformThinLTO("perform-thinlto", cl::init(false), cl::Hidden, cl::desc("Enable performing ThinLTO."))
llvm::PassManagerBuilder::EP_LateLoopOptimizations
@ EP_LateLoopOptimizations
EP_LateLoopOptimizations - This extension point allows adding late loop canonicalization and simplifi...
Definition: PassManagerBuilder.h:112
llvm::createLoopInstSimplifyPass
Pass * createLoopInstSimplifyPass()
Definition: LoopInstSimplify.cpp:246
llvm::PassManagerBuilder::EnablePGOCSInstrGen
bool EnablePGOCSInstrGen
Enable profile context sensitive instrumentation pass.
Definition: PassManagerBuilder.h:179
LLVMPassManagerBuilderCreate
LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate()
See llvm::PassManagerBuilder.
Definition: PassManagerBuilder.cpp:1247
llvm::createPromoteMemoryToRegisterPass
FunctionPass * createPromoteMemoryToRegisterPass()
Definition: Mem2Reg.cpp:114
llvm::PassManagerBuilder::EnablePGOCSInstrUse
bool EnablePGOCSInstrUse
Enable profile context sensitive profile use pass.
Definition: PassManagerBuilder.h:181
llvm::createInstructionCombiningPass
FunctionPass * createInstructionCombiningPass()
Definition: InstructionCombining.cpp:4270
LLVMPassManagerBuilderPopulateModulePassManager
void LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)
See llvm::PassManagerBuilder::populateModulePassManager.
Definition: PassManagerBuilder.cpp:1306
llvm::createEliminateAvailableExternallyPass
ModulePass * createEliminateAvailableExternallyPass()
This transform is designed to eliminate available external globals (functions or global variables)
llvm::PassManagerBuilder::populateFunctionPassManager
void populateFunctionPassManager(legacy::FunctionPassManager &FPM)
populateFunctionPassManager - This fills in the function pass manager, which is expected to be run on...
Definition: PassManagerBuilder.cpp:312
llvm::SimplifyCFGOptions
Definition: SimplifyCFGOptions.h:23
llvm::createLICMPass
Pass * createLICMPass()
Definition: LICM.cpp:327
llvm::PassManagerBuilder::DisableUnrollLoops
bool DisableUnrollLoops
Definition: PassManagerBuilder.h:157
llvm::createConstraintEliminationPass
FunctionPass * createConstraintEliminationPass()
Definition: ConstraintElimination.cpp:547
llvm::PassManagerBuilder::EP_EarlyAsPossible
@ EP_EarlyAsPossible
EP_EarlyAsPossible - This extension point allows adding passes before any other transformations,...
Definition: PassManagerBuilder.h:72
SmallVector.h
llvm::NONE
@ NONE
Definition: Attributor.h:4616
llvm::createLowerConstantIntrinsicsPass
FunctionPass * createLowerConstantIntrinsicsPass()
Definition: LowerConstantIntrinsics.cpp:203
llvm::createConstantMergePass
ModulePass * createConstantMergePass()
createConstantMergePass - This function returns a new pass that merges duplicate global constants tog...
llvm::legacy::FunctionPassManager
FunctionPassManager manages FunctionPasses.
Definition: LegacyPassManager.h:71
llvm::PassManagerBuilder::EP_EnabledOnOptLevel0
@ EP_EnabledOnOptLevel0
EP_EnabledOnOptLevel0 - This extension point allows adding passes that should not be disabled by O0 o...
Definition: PassManagerBuilder.h:99
llvm::createLoopFlattenPass
FunctionPass * createLoopFlattenPass()
Definition: LoopFlatten.cpp:823
llvm::createInstrOrderFilePass
ModulePass * createInstrOrderFilePass()
Definition: InstrOrderFile.cpp:209
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
Threshold
static cl::opt< unsigned > Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(100), cl::Hidden)
LICM.h
llvm::EnableLoopInterchange
cl::opt< bool > EnableLoopInterchange
Vectorize.h
llvm::EnableUnrollAndJam
cl::opt< bool > EnableUnrollAndJam
llvm::createPartialInliningPass
ModulePass * createPartialInliningPass()
createPartialInliningPass - This pass inlines parts of functions.
Definition: PartialInlining.cpp:1524
llvm::createWarnMissedTransformationsPass
Pass * createWarnMissedTransformationsPass()
Definition: WarnMissedTransforms.cpp:148
llvm::AttributorRun
cl::opt< AttributorRunOption > AttributorRun
llvm::PassManagerBuilder::addExtension
void addExtension(ExtensionPointTy Ty, ExtensionFn Fn)
Definition: PassManagerBuilder.cpp:271
llvm::PassManagerBuilder::populateThinLTOPassManager
void populateThinLTOPassManager(legacy::PassManagerBase &PM)
Definition: PassManagerBuilder.cpp:1173
llvm::PassManagerBuilder::EP_FullLinkTimeOptimizationEarly
@ EP_FullLinkTimeOptimizationEarly
EP_FullLinkTimeOptimizationEarly - This extensions point allow adding passes that run at Link Time,...
Definition: PassManagerBuilder.h:122
InstCombine.h
llvm::createSpeculativeExecutionIfHasBranchDivergencePass
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
Definition: SpeculativeExecution.cpp:329
llvm::cl::desc
Definition: CommandLine.h:414
llvm::createLowerMatrixIntrinsicsMinimalPass
Pass * createLowerMatrixIntrinsicsMinimalPass()
Definition: LowerMatrixIntrinsics.cpp:2363
llvm::PassManagerBuilder::DivergentTarget
bool DivergentTarget
Definition: PassManagerBuilder.h:172
llvm::PassManagerBuilder::EP_CGSCCOptimizerLate
@ EP_CGSCCOptimizerLate
EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC passes at the end of the main...
Definition: PassManagerBuilder.h:117
llvm::createFunctionSpecializationPass
ModulePass * createFunctionSpecializationPass()
createFunctionSpecializationPass - This pass propagates constants from call sites to the specialized ...
Definition: SCCP.cpp:193
llvm::SetLicmMssaOptCap
cl::opt< unsigned > SetLicmMssaOptCap
llvm::createLoopDeletionPass
Pass * createLoopDeletionPass()
Definition: LoopDeletion.cpp:563
llvm::createSROAPass
FunctionPass * createSROAPass()
Definition: SROA.cpp:4802
MPM
ModulePassManager MPM
Definition: PassBuilderBindings.cpp:70
InitializePasses.h
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
FunctionAttrs.h
llvm::EnableFunctionSpecialization
cl::opt< bool > EnableFunctionSpecialization
CFLSteensAliasAnalysis.h
llvm::createLoopUnrollAndJamPass
Pass * createLoopUnrollAndJamPass(int OptLevel=2)
Definition: LoopUnrollAndJamPass.cpp:523
llvm::createJumpThreadingPass
FunctionPass * createJumpThreadingPass(bool FreezeSelectCond=false, int Threshold=-1)
Definition: JumpThreading.cpp:178
llvm::createLoopVectorizePass
Pass * createLoopVectorizePass()
Definition: LoopVectorize.cpp:7960
GlobalExtensionsNotEmpty
static bool GlobalExtensionsNotEmpty()
Check if GlobalExtensions is constructed and not empty.
Definition: PassManagerBuilder.cpp:242
llvm::createLoopUnrollPass
Pass * createLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false, int Threshold=-1, int Count=-1, int AllowPartial=-1, int Runtime=-1, int UpperBound=-1, int AllowPeeling=-1)
Definition: LoopUnrollPass.cpp:1431
llvm::createAnnotation2MetadataLegacyPass
ModulePass * createAnnotation2MetadataLegacyPass()
Definition: Annotation2Metadata.cpp:98
llvm::createOpenMPOptCGSCCLegacyPass
Pass * createOpenMPOptCGSCCLegacyPass()
createOpenMPOptLegacyPass - OpenMP specific optimizations.
Definition: OpenMPOpt.cpp:4766
Passes.h
llvm::EnableGVNHoist
cl::opt< bool > EnableGVNHoist