LLVM  16.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"
29 #include "llvm/Transforms/IPO.h"
36 #include "llvm/Transforms/Scalar.h"
41 #include "llvm/Transforms/Utils.h"
43 
44 using namespace llvm;
45 
46 namespace llvm {
47 cl::opt<bool> RunPartialInlining("enable-partial-inlining", cl::Hidden,
48  cl::desc("Run Partial inlinining pass"));
49 
50 static cl::opt<bool>
51 UseGVNAfterVectorization("use-gvn-after-vectorization",
52  cl::init(false), cl::Hidden,
53  cl::desc("Run GVN instead of Early CSE after vectorization passes"));
54 
56  "extra-vectorizer-passes", cl::init(false), cl::Hidden,
57  cl::desc("Run cleanup optimization passes after vectorization."));
58 
59 static cl::opt<bool>
60 RunLoopRerolling("reroll-loops", cl::Hidden,
61  cl::desc("Run the loop rerolling pass"));
62 
63 cl::opt<bool> RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden,
64  cl::desc("Run the NewGVN pass"));
65 
66 // Experimental option to use CFL-AA
68  UseCFLAA("use-cfl-aa", cl::init(::CFLAAType::None), cl::Hidden,
69  cl::desc("Enable the new, experimental CFL alias analysis"),
70  cl::values(clEnumValN(::CFLAAType::None, "none", "Disable CFL-AA"),
72  "Enable unification-based CFL-AA"),
73  clEnumValN(::CFLAAType::Andersen, "anders",
74  "Enable inclusion-based CFL-AA"),
75  clEnumValN(::CFLAAType::Both, "both",
76  "Enable both variants of CFL-AA")));
77 
79  "enable-loopinterchange", cl::init(false), cl::Hidden,
80  cl::desc("Enable the experimental LoopInterchange Pass"));
81 
82 cl::opt<bool> EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false),
83  cl::Hidden,
84  cl::desc("Enable Unroll And Jam Pass"));
85 
86 cl::opt<bool> EnableLoopFlatten("enable-loop-flatten", cl::init(false),
87  cl::Hidden,
88  cl::desc("Enable the LoopFlatten Pass"));
89 
90 cl::opt<bool> EnableDFAJumpThreading("enable-dfa-jump-thread",
91  cl::desc("Enable DFA jump threading."),
92  cl::init(false), cl::Hidden);
93 
94 cl::opt<bool> EnableHotColdSplit("hot-cold-split",
95  cl::desc("Enable hot-cold splitting pass"));
96 
97 cl::opt<bool> EnableIROutliner("ir-outliner", cl::init(false), cl::Hidden,
98  cl::desc("Enable ir outliner pass"));
99 
101  "enable-loop-versioning-licm", cl::init(false), cl::Hidden,
102  cl::desc("Enable the experimental Loop Versioning LICM pass"));
103 
105  DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden,
106  cl::desc("Disable pre-instrumentation inliner"));
107 
109  "preinline-threshold", cl::Hidden, cl::init(75),
110  cl::desc("Control the amount of inlining in pre-instrumentation inliner "
111  "(default = 75)"));
112 
114  EnableGVNHoist("enable-gvn-hoist",
115  cl::desc("Enable the GVN hoisting pass (default = off)"));
116 
117 static cl::opt<bool>
118  DisableLibCallsShrinkWrap("disable-libcalls-shrinkwrap", cl::init(false),
119  cl::Hidden,
120  cl::desc("Disable shrink-wrap library calls"));
121 
123  EnableGVNSink("enable-gvn-sink",
124  cl::desc("Enable the GVN sinking pass (default = off)"));
125 
126 // This option is used in simplifying testing SampleFDO optimizations for
127 // profile loading.
129  EnableCHR("enable-chr", cl::init(true), cl::Hidden,
130  cl::desc("Enable control height reduction optimization (CHR)"));
131 
133  "flattened-profile-used", cl::init(false), cl::Hidden,
134  cl::desc("Indicate the sample profile being used is flattened, i.e., "
135  "no inline hierachy exists in the profile. "));
136 
138  "enable-order-file-instrumentation", cl::init(false), cl::Hidden,
139  cl::desc("Enable order file instrumentation (default = off)"));
140 
142  "enable-matrix", cl::init(false), cl::Hidden,
143  cl::desc("Enable lowering of the matrix intrinsics"));
144 
146  "enable-constraint-elimination", cl::init(false), cl::Hidden,
147  cl::desc(
148  "Enable pass to eliminate conditions based on linear constraints."));
149 
151  "enable-function-specialization", cl::init(false), cl::Hidden,
152  cl::desc("Enable Function Specialization pass"));
153 
155  "attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE),
156  cl::desc("Enable the attributor inter-procedural deduction pass."),
158  "enable all attributor runs"),
160  "enable module-wide attributor runs"),
162  "enable call graph SCC attributor runs"),
164  "disable attributor runs")));
165 
167 } // namespace llvm
168 
170  OptLevel = 2;
171  SizeLevel = 0;
172  LibraryInfo = nullptr;
173  Inliner = nullptr;
174  DisableUnrollLoops = false;
175  SLPVectorize = false;
176  LoopVectorize = true;
177  LoopsInterleaved = true;
179  NewGVN = RunNewGVN;
182  DisableGVNLoadPRE = false;
184  VerifyInput = false;
185  VerifyOutput = false;
186  MergeFunctions = false;
187  DivergentTarget = false;
188  CallGraphProfile = true;
189 }
190 
192  delete LibraryInfo;
193  delete Inliner;
194 }
195 
196 /// Set of global extensions, automatically added as part of the standard set.
197 static ManagedStatic<
201  8>>
204 
205 /// Check if GlobalExtensions is constructed and not empty.
206 /// Since GlobalExtensions is a managed static, calling 'empty()' will trigger
207 /// the construction of the object.
209  return GlobalExtensions.isConstructed() && !GlobalExtensions->empty();
210 }
211 
215  auto ExtensionID = GlobalExtensionsCounter++;
216  GlobalExtensions->push_back(std::make_tuple(Ty, std::move(Fn), ExtensionID));
217  return ExtensionID;
218 }
219 
222  // RegisterStandardPasses may try to call this function after GlobalExtensions
223  // has already been destroyed; doing so should not generate an error.
224  if (!GlobalExtensions.isConstructed())
225  return;
226 
227  auto GlobalExtension =
228  llvm::find_if(*GlobalExtensions, [ExtensionID](const auto &elem) {
229  return std::get<2>(elem) == ExtensionID;
230  });
231  assert(GlobalExtension != GlobalExtensions->end() &&
232  "The extension ID to be removed should always be valid.");
233 
234  GlobalExtensions->erase(GlobalExtension);
235 }
236 
238  Extensions.push_back(std::make_pair(Ty, std::move(Fn)));
239 }
240 
241 void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy,
242  legacy::PassManagerBase &PM) const {
243  if (GlobalExtensionsNotEmpty()) {
244  for (auto &Ext : *GlobalExtensions) {
245  if (std::get<0>(Ext) == ETy)
246  std::get<1>(Ext)(*this, PM);
247  }
248  }
249  for (const auto &[PT, Fn] : Extensions)
250  if (PT == ETy)
251  Fn(*this, PM);
252 }
253 
254 void PassManagerBuilder::addInitialAliasAnalysisPasses(
255  legacy::PassManagerBase &PM) const {
256  switch (UseCFLAA) {
257  case ::CFLAAType::Steensgaard:
259  break;
260  case ::CFLAAType::Andersen:
262  break;
263  case ::CFLAAType::Both:
266  break;
267  default:
268  break;
269  }
270 
271  // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
272  // BasicAliasAnalysis wins if they disagree. This is intended to help
273  // support "obvious" type-punning idioms.
276 }
277 
280  addExtensionsToPM(EP_EarlyAsPossible, FPM);
281 
282  // Add LibraryInfo if we have some.
283  if (LibraryInfo)
285 
286  // The backends do not handle matrix intrinsics currently.
287  // Make sure they are also lowered in O0.
288  // FIXME: A lightweight version of the pass should run in the backend
289  // pipeline on demand.
290  if (EnableMatrix && OptLevel == 0)
292 
293  if (OptLevel == 0) return;
294 
295  addInitialAliasAnalysisPasses(FPM);
296 
297  // Lower llvm.expect to metadata before attempting transforms.
298  // Compare/branch metadata may alter the behavior of passes like SimplifyCFG.
301  FPM.add(createSROAPass());
302  FPM.add(createEarlyCSEPass());
303 }
304 
305 void PassManagerBuilder::addFunctionSimplificationPasses(
307  // Start of function pass.
308  // Break up aggregate allocas, using SSAUpdater.
309  assert(OptLevel >= 1 && "Calling function optimizer with no optimization level!");
310  MPM.add(createSROAPass());
311  MPM.add(createEarlyCSEPass(true /* Enable mem-ssa. */)); // Catch trivial redundancies
314 
315  if (OptLevel > 1) {
316  if (EnableGVNHoist)
317  MPM.add(createGVNHoistPass());
318  if (EnableGVNSink) {
319  MPM.add(createGVNSinkPass());
321  SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
322  }
323  }
324 
327 
328  if (OptLevel > 1) {
329  // Speculative execution if the target has divergent branches; otherwise nop.
331 
332  MPM.add(createJumpThreadingPass()); // Thread jumps.
333  MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals
334  }
335  MPM.add(
336  createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
337  true))); // Merge & remove BBs
338  // Combine silly seq's
339  if (OptLevel > 2)
344  addExtensionsToPM(EP_Peephole, MPM);
345 
346  // TODO: Investigate the cost/benefit of tail call elimination on debugging.
347  if (OptLevel > 1)
348  MPM.add(createTailCallEliminationPass()); // Eliminate tail calls
349  MPM.add(
350  createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
351  true))); // Merge & remove BBs
352  MPM.add(createReassociatePass()); // Reassociate expressions
353 
354  // The matrix extension can introduce large vector operations early, which can
355  // benefit from running vector-combine early on.
356  if (EnableMatrix)
358 
359  // Begin the loop pass pipeline.
360 
361  // The simple loop unswitch pass relies on separate cleanup passes. Schedule
362  // them first so when we re-process a loop they run before other loop
363  // passes.
366 
367  // Try to remove as much code from the loop header as possible,
368  // to reduce amount of IR that will have to be duplicated. However,
369  // do not perform speculative hoisting the first time as LICM
370  // will destroy metadata that may not need to be destroyed if run
371  // after loop rotation.
372  // TODO: Investigate promotion cap for O1.
374  /*AllowSpeculation=*/false));
375  // Rotate Loop - disable header duplication at -Oz
376  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, false));
377  // TODO: Investigate promotion cap for O1.
379  /*AllowSpeculation=*/true));
381  // FIXME: We break the loop pass pipeline here in order to do full
382  // simplifycfg. Eventually loop-simplifycfg should be enhanced to replace the
383  // need for this.
385  SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
387  // We resume loop passes creating a second loop pipeline here.
388  if (EnableLoopFlatten) {
389  MPM.add(createLoopFlattenPass()); // Flatten loops
391  }
392  MPM.add(createLoopIdiomPass()); // Recognize idioms like memset.
393  MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars
394  addExtensionsToPM(EP_LateLoopOptimizations, MPM);
395  MPM.add(createLoopDeletionPass()); // Delete dead loops
396 
398  MPM.add(createLoopInterchangePass()); // Interchange loops
399 
400  // Unroll small loops and perform peeling.
403  addExtensionsToPM(EP_LoopOptimizerEnd, MPM);
404  // This ends the loop pass pipelines.
405 
406  // Break up allocas that may now be splittable after loop unrolling.
407  MPM.add(createSROAPass());
408 
409  if (OptLevel > 1) {
410  MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds
411  MPM.add(NewGVN ? createNewGVNPass()
412  : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
413  }
414  MPM.add(createSCCPPass()); // Constant prop with SCCP
415 
418 
419  // Delete dead bit computations (instcombine runs after to fold away the dead
420  // computations, and then ADCE will run later to exploit any new DCE
421  // opportunities that creates).
422  MPM.add(createBitTrackingDCEPass()); // Delete dead bit computations
423 
424  // Run instcombine after redundancy elimination to exploit opportunities
425  // opened up by them.
427  addExtensionsToPM(EP_Peephole, MPM);
428  if (OptLevel > 1) {
429  if (EnableDFAJumpThreading && SizeLevel == 0)
431 
432  MPM.add(createJumpThreadingPass()); // Thread jumps
434  }
435  MPM.add(createAggressiveDCEPass()); // Delete dead instructions
436 
437  MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset
438  // TODO: Investigate if this is too expensive at O1.
439  if (OptLevel > 1) {
440  MPM.add(createDeadStoreEliminationPass()); // Delete dead stores
442  /*AllowSpeculation=*/true));
443  }
444 
445  addExtensionsToPM(EP_ScalarOptimizerLate, MPM);
446 
447  if (RerollLoops)
448  MPM.add(createLoopRerollPass());
449 
450  // Merge & remove BBs and sink & hoist common instructions.
452  SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true)));
453  // Clean up after everything.
455  addExtensionsToPM(EP_Peephole, MPM);
456 }
457 
458 /// FIXME: Should LTO cause any differences to this set of passes?
459 void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
460  bool IsFullLTO) {
462 
463  if (IsFullLTO) {
464  // The vectorizer may have significantly shortened a loop body; unroll
465  // again. Unroll small loops to hide loop backedge latency and saturate any
466  // parallel execution resources of an out-of-order processor. We also then
467  // need to clean up redundancies and loop invariant code.
468  // FIXME: It would be really good to use a loop-integrated instruction
469  // combiner for cleanup here so that the unrolling and LICM can be pipelined
470  // across the loop nests.
471  // We do UnrollAndJam in a separate LPM to ensure it happens before unroll
477  }
478 
479  if (!IsFullLTO) {
480  // Eliminate loads by forwarding stores from the previous iteration to loads
481  // of the current iteration.
483  }
484  // Cleanup after the loop optimization passes.
486 
487  if (OptLevel > 1 && ExtraVectorizerPasses) {
488  // At higher optimization levels, try to clean up any runtime overlap and
489  // alignment checks inserted by the vectorizer. We want to track correlated
490  // runtime checks for two inner loops in the same outer loop, fold any
491  // common computations, hoist loop-invariant aspects out of any outer loop,
492  // and unswitch the runtime checks if possible. Once hoisted, we may have
493  // dead (or speculatable) control flows or more combining opportunities.
494  PM.add(createEarlyCSEPass());
498  /*AllowSpeculation=*/true));
501  SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
503  }
504 
505  // Now that we've formed fast to execute loop structures, we do further
506  // optimizations. These are run afterward as they might block doing complex
507  // analyses and transforms such as what are needed for loop vectorization.
508 
509  // Cleanup after loop vectorization, etc. Simplification passes like CVP and
510  // GVN, loop transforms, and others have already run, so it's now better to
511  // convert to more optimized IR using more aggressive simplify CFG options.
512  // The extra sinking transform can create larger basic blocks, so do this
513  // before SLP vectorization.
515  .forwardSwitchCondToPhi(true)
516  .convertSwitchRangeToICmp(true)
517  .convertSwitchToLookupTable(true)
518  .needCanonicalLoops(false)
519  .hoistCommonInsts(true)
520  .sinkCommonInsts(true)));
521 
522  if (IsFullLTO) {
523  PM.add(createSCCPPass()); // Propagate exposed constants
524  PM.add(createInstructionCombiningPass()); // Clean up again
526  }
527 
528  // Optimize parallel scalar instruction chains into SIMD instructions.
529  if (SLPVectorize) {
531  if (OptLevel > 1 && ExtraVectorizerPasses)
532  PM.add(createEarlyCSEPass());
533  }
534 
535  // Enhance/cleanup vector code.
537 
538  if (!IsFullLTO) {
539  addExtensionsToPM(EP_Peephole, PM);
541 
543  // Unroll and Jam. We do this before unroll but need to be in a separate
544  // loop pass manager in order for the outer loop to be processed by
545  // unroll and jam before the inner loop is unrolled.
547  }
548 
549  // Unroll small loops
552 
553  if (!DisableUnrollLoops) {
554  // LoopUnroll may generate some redundency to cleanup.
556 
557  // Runtime unrolling will introduce runtime check in loop prologue. If the
558  // unrolled loop is a inner loop, then the prologue will be inside the
559  // outer loop. LICM pass can help to promote the runtime check out if the
560  // checked value is loop invariant.
562  /*AllowSpeculation=*/true));
563  }
564 
566  }
567 
568  // After vectorization and unrolling, assume intrinsics may tell us more
569  // about pointer alignments.
571 
572  if (IsFullLTO)
574 }
575 
579 
580  // Allow forcing function attributes as a debugging and tuning aid.
582 
583  // If all optimizations are disabled, just run the always-inline pass and,
584  // if enabled, the function merging pass.
585  if (OptLevel == 0) {
586  if (Inliner) {
587  MPM.add(Inliner);
588  Inliner = nullptr;
589  }
590 
591  // FIXME: The BarrierNoopPass is a HACK! The inliner pass above implicitly
592  // creates a CGSCC pass manager, but we don't want to add extensions into
593  // that pass manager. To prevent this we insert a no-op module pass to reset
594  // the pass manager to get the same behavior as EP_OptimizerLast in non-O0
595  // builds. The function merging pass is
596  if (MergeFunctions)
598  else if (GlobalExtensionsNotEmpty() || !Extensions.empty())
599  MPM.add(createBarrierNoopPass());
600 
601  addExtensionsToPM(EP_EnabledOnOptLevel0, MPM);
602 
604  return;
605  }
606 
607  // Add LibraryInfo if we have some.
608  if (LibraryInfo)
610 
611  addInitialAliasAnalysisPasses(MPM);
612 
613  // Infer attributes about declarations if possible.
615 
616  // Infer attributes on declarations, call sites, arguments, etc.
619 
620  addExtensionsToPM(EP_ModuleOptimizerEarly, MPM);
621 
622  if (OptLevel > 2)
624 
625  // Propage constant function arguments by specializing the functions.
628 
629  MPM.add(createIPSCCPPass()); // IP SCCP
631 
632  MPM.add(createGlobalOptimizerPass()); // Optimize out global vars
633  // Promote any localized global vars.
635 
636  MPM.add(createDeadArgEliminationPass()); // Dead argument elimination
637 
638  MPM.add(createInstructionCombiningPass()); // Clean up after IPCP & DAE
639  addExtensionsToPM(EP_Peephole, MPM);
640  MPM.add(
641  createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp(
642  true))); // Clean up after IPCP & DAE
643 
644  // We add a module alias analysis pass here. In part due to bugs in the
645  // analysis infrastructure this "works" in that the analysis stays alive
646  // for the entire SCC pass run below.
648 
649  // Start of CallGraph SCC passes.
650  bool RunInliner = false;
651  if (Inliner) {
652  MPM.add(Inliner);
653  Inliner = nullptr;
654  RunInliner = true;
655  }
656 
657  // Infer attributes on declarations, call sites, arguments, etc. for an SCC.
660 
661  // Try to perform OpenMP specific optimizations. This is a (quick!) no-op if
662  // there are no OpenMP runtime calls present in the module.
663  if (OptLevel > 1)
665 
667 
668  addExtensionsToPM(EP_CGSCCOptimizerLate, MPM);
669  addFunctionSimplificationPasses(MPM);
670 
671  // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC
672  // pass manager that we are specifically trying to avoid. To prevent this
673  // we must insert a no-op module pass to reset the pass manager.
674  MPM.add(createBarrierNoopPass());
675 
676  if (RunPartialInlining)
678 
679  if (OptLevel > 1)
680  // Remove avail extern fns and globals definitions if we aren't
681  // compiling an object file for later LTO. For LTO we want to preserve
682  // these so they are eligible for inlining at link-time. Note if they
683  // are unreferenced they will be removed by GlobalDCE later, so
684  // this only impacts referenced available externally globals.
685  // Eventually they will be suppressed during codegen, but eliminating
686  // here enables more opportunity for GlobalDCE as it may make
687  // globals referenced by available external functions dead
688  // and saves running remaining passes on the eliminated functions.
690 
692 
693  // The inliner performs some kind of dead code elimination as it goes,
694  // but there are cases that are not really caught by it. We might
695  // at some point consider teaching the inliner about them, but it
696  // is OK for now to run GlobalOpt + GlobalDCE in tandem as their
697  // benefits generally outweight the cost, making the whole pipeline
698  // faster.
699  if (RunInliner) {
701  MPM.add(createGlobalDCEPass());
702  }
703 
704  // Scheduling LoopVersioningLICM when inlining is over, because after that
705  // we may see more accurate aliasing. Reason to run this late is that too
706  // early versioning may prevent further inlining due to increase of code
707  // size. By placing it just after inlining other optimizations which runs
708  // later might get benefit of no-alias assumption in clone loop.
709  if (UseLoopVersioningLICM) {
710  MPM.add(createLoopVersioningLICMPass()); // Do LoopVersioningLICM
712  /*AllowSpeculation=*/true));
713  }
714 
715  // We add a fresh GlobalsModRef run at this point. This is particularly
716  // useful as the above will have inlined, DCE'ed, and function-attr
717  // propagated everything. We should at this point have a reasonably minimal
718  // and richly annotated call graph. By computing aliasing and mod/ref
719  // information for all local globals here, the late loop passes and notably
720  // the vectorizer will be able to use them to help recognize vectorizable
721  // memory operations.
722  //
723  // Note that this relies on a bug in the pass manager which preserves
724  // a module analysis into a function pass pipeline (and throughout it) so
725  // long as the first function pass doesn't invalidate the module analysis.
726  // Thus both Float2Int and LoopRotate have to preserve AliasAnalysis for
727  // this to work. Fortunately, it is trivial to preserve AliasAnalysis
728  // (doing nothing preserves it as it is required to be conservatively
729  // correct in the face of IR changes).
731 
732  MPM.add(createFloat2IntPass());
734 
735  if (EnableMatrix) {
737  // CSE the pointer arithmetic of the column vectors. This allows alias
738  // analysis to establish no-aliasing between loads and stores of different
739  // columns of the same matrix.
740  MPM.add(createEarlyCSEPass(false));
741  }
742 
743  addExtensionsToPM(EP_VectorizerStart, MPM);
744 
745  // Re-rotate loops in all our loop nests. These may have fallout out of
746  // rotated form due to GVN or other transformations, and the vectorizer relies
747  // on the rotated form. Disable header duplication at -Oz.
748  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, false));
749 
750  // Distribute loops to allow partial vectorization. I.e. isolate dependences
751  // into separate loop that would otherwise inhibit vectorization. This is
752  // currently only performed for loops marked with the metadata
753  // llvm.loop.distribute=true or when -enable-loop-distribute is specified.
755 
756  addVectorPasses(MPM, /* IsFullLTO */ false);
757 
758  // FIXME: We shouldn't bother with this anymore.
759  MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes
760 
761  // GlobalOpt already deletes dead functions and globals, at -O2 try a
762  // late pass of GlobalDCE. It is capable of deleting dead cycles.
763  if (OptLevel > 1) {
764  MPM.add(createGlobalDCEPass()); // Remove dead fns and globals.
765  MPM.add(createConstantMergePass()); // Merge dup global constants
766  }
767 
768  // See comment in the new PM for justification of scheduling splitting at
769  // this stage (\ref buildModuleSimplificationPipeline).
770  if (EnableHotColdSplit)
772 
773  if (EnableIROutliner)
774  MPM.add(createIROutlinerPass());
775 
776  if (MergeFunctions)
778 
779  // LoopSink pass sinks instructions hoisted by LICM, which serves as a
780  // canonicalization pass that enables other optimizations. As a result,
781  // LoopSink pass needs to be a very late IR pass to avoid undoing LICM
782  // result too early.
783  MPM.add(createLoopSinkPass());
784  // Get rid of LCSSA nodes.
786 
787  // This hoists/decomposes div/rem ops. It should run after other sink/hoist
788  // passes to avoid re-sinking, but before SimplifyCFG because it can allow
789  // flattening of blocks.
790  MPM.add(createDivRemPairsPass());
791 
792  // LoopSink (and other loop passes since the last simplifyCFG) might have
793  // resulted in single-entry-single-exit or empty blocks. Clean up the CFG.
795  SimplifyCFGOptions().convertSwitchRangeToICmp(true)));
796 
797  addExtensionsToPM(EP_OptimizerLast, MPM);
798 
800 }
801 
804  return wrap(PMB);
805 }
806 
809  delete Builder;
810 }
811 
812 void
814  unsigned OptLevel) {
816  Builder->OptLevel = OptLevel;
817 }
818 
819 void
821  unsigned SizeLevel) {
823  Builder->SizeLevel = SizeLevel;
824 }
825 
826 void
828  LLVMBool Value) {
829  // NOTE: The DisableUnitAtATime switch has been removed.
830 }
831 
832 void
834  LLVMBool Value) {
836  Builder->DisableUnrollLoops = Value;
837 }
838 
839 void
841  LLVMBool Value) {
842  // NOTE: The simplify-libcalls pass has been removed.
843 }
844 
845 void
847  unsigned Threshold) {
849  Builder->Inliner = createFunctionInliningPass(Threshold);
850 }
851 
852 void
854  LLVMPassManagerRef PM) {
856  legacy::FunctionPassManager *FPM = unwrap<legacy::FunctionPassManager>(PM);
857  Builder->populateFunctionPassManager(*FPM);
858 }
859 
860 void
862  LLVMPassManagerRef PM) {
865  Builder->populateModulePassManager(*MPM);
866 }
llvm::PassManagerBuilder::LicmMssaOptCap
unsigned LicmMssaOptCap
Definition: PassManagerBuilder.h:168
llvm::createLoopLoadEliminationPass
FunctionPass * createLoopLoadEliminationPass()
Definition: LoopLoadElimination.cpp:719
llvm::PassManagerBuilder::EP_OptimizerLast
@ EP_OptimizerLast
EP_OptimizerLast – This extension point allows adding passes that run after everything else.
Definition: PassManagerBuilder.h:87
llvm::createAssumeSimplifyPass
FunctionPass * createAssumeSimplifyPass()
Definition: AssumeBundleBuilder.cpp:606
TypeBasedAliasAnalysis.h
Instrumentation.h
llvm::createMergedLoadStoreMotionPass
FunctionPass * createMergedLoadStoreMotionPass(bool SplitFooterBB=false)
createMergedLoadStoreMotionPass - The public interface to this file.
Definition: MergedLoadStoreMotion.cpp:399
llvm::createSimpleLoopUnswitchLegacyPass
Pass * createSimpleLoopUnswitchLegacyPass(bool NonTrivial=false)
Create the legacy pass object for the simple loop unswitcher.
Definition: SimpleLoopUnswitch.cpp:3294
llvm::RunNewGVN
cl::opt< bool > RunNewGVN
llvm::createGVNSinkPass
FunctionPass * createGVNSinkPass()
Definition: GVNSink.cpp:929
LLVMPassManagerBuilderPopulateFunctionPassManager
void LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)
See llvm::PassManagerBuilder::populateFunctionPassManager.
Definition: PassManagerBuilder.cpp:853
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::createTailCallEliminationPass
FunctionPass * createTailCallEliminationPass()
Definition: TailRecursionElimination.cpp:917
llvm::PassManagerBuilder::PassManagerBuilder
PassManagerBuilder()
Definition: PassManagerBuilder.cpp:169
llvm::createCFLAndersAAWrapperPass
ImmutablePass * createCFLAndersAAWrapperPass()
Scalar.h
llvm::PassManagerBuilder::VerifyOutput
bool VerifyOutput
Definition: PassManagerBuilder.h:165
llvm::ExtraVectorizerPasses
cl::opt< bool > ExtraVectorizerPasses
llvm::EnableConstraintElimination
cl::opt< bool > EnableConstraintElimination
llvm::ALL
@ ALL
Definition: Attributor.h:5145
llvm::createCFGSimplificationPass
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
Definition: SimplifyCFGPass.cpp:432
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:1181
llvm::createLoopSimplifyCFGPass
Pass * createLoopSimplifyCFGPass()
Definition: LoopSimplifyCFG.cpp:774
ManagedStatic.h
llvm::PassManagerBuilder::LoopVectorize
bool LoopVectorize
Definition: PassManagerBuilder.h:158
CGPassBuilderOption.h
GlobalsModRef.h
llvm::createEarlyCSEPass
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1774
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:140
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:162
LLVMPassManagerBuilderSetDisableSimplifyLibCalls
void LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableSimplifyLibCalls.
Definition: PassManagerBuilder.cpp:840
llvm::createVectorCombinePass
Pass * createVectorCombinePass()
Definition: VectorCombine.cpp:1656
llvm::createCFLSteensAAWrapperPass
ImmutablePass * createCFLSteensAAWrapperPass()
llvm::createLoopIdiomPass
Pass * createLoopIdiomPass()
Definition: LoopIdiomRecognize.cpp:345
llvm::CFLAAType::Andersen
@ Andersen
llvm::createDeadStoreEliminationPass
FunctionPass * createDeadStoreEliminationPass()
Definition: DeadStoreElimination.cpp:2262
llvm::PassManagerBuilder::ExtensionPointTy
ExtensionPointTy
Definition: PassManagerBuilder.h:66
llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll
bool ForgetAllSCEVInLoopUnroll
Definition: PassManagerBuilder.h:163
LLVMPassManagerBuilderDispose
void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB)
Definition: PassManagerBuilder.cpp:807
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:94
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:293
llvm::createMergeFunctionsPass
ModulePass * createMergeFunctionsPass()
createMergeFunctionsPass - This pass discovers identical functions and collapses them.
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:3234
llvm::EnableGVNSink
cl::opt< bool > EnableGVNSink
llvm::EnableMatrix
cl::opt< bool > EnableMatrix
llvm::createAttributorLegacyPass
Pass * createAttributorLegacyPass()
Definition: Attributor.cpp:3551
STLExtras.h
llvm::createCallSiteSplittingPass
FunctionPass * createCallSiteSplittingPass()
Definition: CallSiteSplitting.cpp:573
LegacyPassManager.h
PassManagerBuilder.h
llvm::createInferFunctionAttrsLegacyPass
Pass * createInferFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to infer function attributes.
Definition: InferFunctionAttrs.cpp:87
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:78
llvm::createAttributorCGSCCLegacyPass
Pass * createAttributorCGSCCLegacyPass()
Definition: Attributor.cpp:3552
llvm::createFloat2IntPass
FunctionPass * createFloat2IntPass()
Definition: Float2Int.cpp:532
llvm::createDivRemPairsPass
FunctionPass * createDivRemPairsPass()
Definition: DivRemPairs.cpp:429
llvm::createSLPVectorizerPass
Pass * createSLPVectorizerPass()
Definition: SLPVectorizer.cpp:12761
CommandLine.h
llvm::MODULE
@ MODULE
Definition: Attributor.h:5143
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:202
llvm::createForceFunctionAttrsLegacyPass
Pass * createForceFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to force function attrs.
llvm::createDFAJumpThreadingPass
FunctionPass * createDFAJumpThreadingPass()
Definition: DFAJumpThreading.cpp:212
llvm::FlattenedProfileUsed
cl::opt< bool > FlattenedProfileUsed
llvm::PassManagerBuilder::NewGVN
bool NewGVN
Definition: PassManagerBuilder.h:161
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:213
llvm::createLoopInterchangePass
Pass * createLoopInterchangePass()
Definition: LoopInterchange.cpp:1752
llvm::PassManagerBuilder::LibraryInfo
TargetLibraryInfoImpl * LibraryInfo
LibraryInfo - Specifies information about the runtime library for the optimizer.
Definition: PassManagerBuilder.h:139
llvm::createLowerMatrixIntrinsicsPass
Pass * createLowerMatrixIntrinsicsPass()
Definition: LowerMatrixIntrinsics.cpp:2388
llvm::createLoopVersioningLICMPass
Pass * createLoopVersioningLICMPass()
Definition: LoopVersioningLICM.cpp:658
llvm::createNewGVNPass
FunctionPass * createNewGVNPass()
Definition: NewGVN.cpp:4254
llvm::ManagedStatic
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
Definition: ManagedStatic.h:83
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:203
llvm::DisablePreInliner
cl::opt< bool > DisablePreInliner
llvm::createLibCallsShrinkWrapPass
FunctionPass * createLibCallsShrinkWrapPass()
Definition: LibCallsShrinkWrap.cpp:548
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:280
llvm::PassManagerBuilder::Inliner
Pass * Inliner
Inliner - Specifies the inliner to use.
Definition: PassManagerBuilder.h:143
llvm::PassManagerBuilder::MergeFunctions
bool MergeFunctions
Definition: PassManagerBuilder.h:166
llvm::createIndVarSimplifyPass
Pass * createIndVarSimplifyPass()
Definition: IndVarSimplify.cpp:2153
GVN.h
llvm::createAnnotationRemarksLegacyPass
FunctionPass * createAnnotationRemarksLegacyPass()
Definition: AnnotationRemarks.cpp:117
llvm::createGlobalOptimizerPass
ModulePass * createGlobalOptimizerPass()
createGlobalOptimizerPass - This function returns a new pass that optimizes non-address taken interna...
Definition: GlobalOpt.cpp:2623
llvm::createLoopDistributePass
FunctionPass * createLoopDistributePass()
llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap
unsigned LicmMssaNoAccForPromotionCap
Definition: PassManagerBuilder.h:169
llvm::CSKYAttrs::NONE
@ NONE
Definition: CSKYAttributes.h:76
CFLAndersAliasAnalysis.h
Utils.h
ScopedNoAliasAA.h
llvm::EnableDFAJumpThreading
cl::opt< bool > EnableDFAJumpThreading
llvm::PassManagerBuilder::LoopsInterleaved
bool LoopsInterleaved
Definition: PassManagerBuilder.h:159
llvm::createHotColdSplittingPass
ModulePass * createHotColdSplittingPass()
createHotColdSplittingPass - This pass outlines cold blocks into a separate function(s).
Definition: HotColdSplitting.cpp:781
llvm::createSimpleLoopUnrollPass
Pass * createSimpleLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false)
Definition: LoopUnrollPass.cpp:1466
llvm::createFunctionInliningPass
Pass * createFunctionInliningPass()
createFunctionInliningPass - Return a new pass object that uses a heuristic to inline direct function...
Definition: InlineSimple.cpp:91
llvm::legacy::PassManagerBase::add
virtual void add(Pass *P)=0
Add a pass to the queue of passes to run.
LLVMPassManagerBuilderUseInlinerWithThreshold
void LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB, unsigned Threshold)
See llvm::PassManagerBuilder::Inliner.
Definition: PassManagerBuilder.cpp:846
llvm::PassManagerBuilder
PassManagerBuilder - This class is used to set up a standard optimization sequence for languages like...
Definition: PassManagerBuilder.h:57
llvm::createGlobalsAAWrapperPass
ModulePass * createGlobalsAAWrapperPass()
Definition: GlobalsModRef.cpp:1017
llvm::createIPSCCPPass
ModulePass * createIPSCCPPass()
createIPSCCPPass - This pass propagates constants from call sites into the bodies of functions,...
Definition: SCCP.cpp:107
llvm::PassManagerBuilder::~PassManagerBuilder
~PassManagerBuilder()
Definition: PassManagerBuilder.cpp:191
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:501
llvm::CFLAAType::None
@ None
llvm::MipsISD::Ext
@ Ext
Definition: MipsISelLowering.h:159
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:693
llvm::createGVNHoistPass
FunctionPass * createGVNHoistPass()
Definition: GVNHoist.cpp:1267
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:83
llvm::TargetLibraryInfoWrapperPass
Definition: TargetLibraryInfo.h:468
llvm::createReversePostOrderFunctionAttrsPass
Pass * createReversePostOrderFunctionAttrsPass()
createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call graph in RPO to deduce and...
Definition: FunctionAttrs.cpp:1962
llvm::createAggressiveInstCombinerPass
FunctionPass * createAggressiveInstCombinerPass()
Definition: AggressiveInstCombine.cpp:950
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:63
llvm::createLowerExpectIntrinsicPass
FunctionPass * createLowerExpectIntrinsicPass()
LLVMPassManagerBuilderRef
struct LLVMOpaquePassManagerBuilder * LLVMPassManagerBuilderRef
Definition: PassManagerBuilder.h:20
AggressiveInstCombine.h
llvm::PassManagerBuilder::RerollLoops
bool RerollLoops
Definition: PassManagerBuilder.h:160
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:440
llvm::PassManagerBuilder::OptLevel
unsigned OptLevel
The Optimization Level - Specify the basic optimization level.
Definition: PassManagerBuilder.h:130
llvm::createCorrelatedValuePropagationPass
Pass * createCorrelatedValuePropagationPass()
Definition: CorrelatedValuePropagation.cpp:131
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:1910
llvm::PreInlineThreshold
cl::opt< int > PreInlineThreshold
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::EnableHotColdSplit
cl::opt< bool > EnableHotColdSplit
llvm::PassManagerBuilder::GlobalExtensionID
int GlobalExtensionID
Definition: PassManagerBuilder.h:64
llvm::PassManagerBuilder::VerifyInput
bool VerifyInput
Definition: PassManagerBuilder.h:164
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:1335
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::createSCCPPass
FunctionPass * createSCCPPass()
Definition: SCCP.cpp:366
LLVMPassManagerRef
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition: Types.h:127
llvm::CFLAAType::Steensgaard
@ Steensgaard
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:275
llvm::PassManagerBuilder::CallGraphProfile
bool CallGraphProfile
Definition: PassManagerBuilder.h:156
llvm::RunPartialInlining
cl::opt< bool > RunPartialInlining
llvm::CGSCC
@ CGSCC
Definition: Attributor.h:5144
llvm::PassManagerBuilder::SLPVectorize
bool SLPVectorize
Definition: PassManagerBuilder.h:157
llvm::createIROutlinerPass
ModulePass * createIROutlinerPass()
createIROutlinerPass - This pass finds similar code regions and factors those regions out into functi...
Definition: IROutliner.cpp:3087
llvm::EnableLoopFlatten
cl::opt< bool > EnableLoopFlatten
clEnumValN
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
Definition: CommandLine.h:668
llvm::PassManagerBuilder::EP_Peephole
@ EP_Peephole
EP_Peephole - This extension point allows adding passes that perform peephole optimizations similar t...
Definition: PassManagerBuilder.h:102
llvm::createCalledValuePropagationPass
ModulePass * createCalledValuePropagationPass()
createCalledValuePropagationPass - Attach metadata to indirct call sites indicating the set of functi...
llvm::createReassociatePass
FunctionPass * createReassociatePass()
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:1617
LLVMPassManagerBuilderSetOptLevel
void LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, unsigned OptLevel)
See llvm::PassManagerBuilder::OptLevel.
Definition: PassManagerBuilder.cpp:813
llvm::ForgetSCEVInLoopUnroll
cl::opt< bool > ForgetSCEVInLoopUnroll
llvm::createAggressiveDCEPass
FunctionPass * createAggressiveDCEPass()
Definition: ADCE.cpp:754
llvm::PassManagerBuilder::removeGlobalExtension
static void removeGlobalExtension(GlobalExtensionID ExtensionID)
Removes an extension that was previously added using addGlobalExtension.
Definition: PassManagerBuilder.cpp:220
LLVMPassManagerBuilderSetSizeLevel
void LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, unsigned SizeLevel)
See llvm::PassManagerBuilder::SizeLevel.
Definition: PassManagerBuilder.cpp:820
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:92
llvm::EnableCHR
cl::opt< bool > EnableCHR
LoopUnrollPass.h
llvm::createScopedNoAliasAAWrapperPass
ImmutablePass * createScopedNoAliasAAWrapperPass()
llvm::createBitTrackingDCEPass
FunctionPass * createBitTrackingDCEPass()
Definition: BDCE.cpp:207
llvm::createAlignmentFromAssumptionsPass
FunctionPass * createAlignmentFromAssumptionsPass()
Definition: AlignmentFromAssumptions.cpp:83
LLVMPassManagerBuilderSetDisableUnitAtATime
void LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableUnitAtATime.
Definition: PassManagerBuilder.cpp:827
llvm::PassManagerBuilder::populateModulePassManager
void populateModulePassManager(legacy::PassManagerBase &MPM)
populateModulePassManager - This sets up the primary pass manager.
Definition: PassManagerBuilder.cpp:576
llvm::PassManagerBuilder::EP_ModuleOptimizerEarly
@ EP_ModuleOptimizerEarly
EP_ModuleOptimizerEarly - This extension point allows adding passes just before the main module-level...
Definition: PassManagerBuilder.h:74
llvm::TargetStackID::Value
Value
Definition: TargetFrameLowering.h:27
llvm::createLoopRotatePass
Pass * createLoopRotatePass(int MaxHeaderSize=-1, bool PrepareForLTO=false)
Definition: LoopRotation.cpp:150
LLVMPassManagerBuilderSetDisableUnrollLoops
void LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableUnrollLoops.
Definition: PassManagerBuilder.cpp:833
PassManagerBuilder.h
llvm::PassManagerBuilder::SizeLevel
unsigned SizeLevel
SizeLevel - How much we're optimizing for size.
Definition: PassManagerBuilder.h:134
llvm::createInstSimplifyLegacyPass
FunctionPass * createInstSimplifyLegacyPass()
Definition: InstSimplifyPass.cpp:125
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::PassManagerBuilder::EP_LateLoopOptimizations
@ EP_LateLoopOptimizations
EP_LateLoopOptimizations - This extension point allows adding late loop canonicalization and simplifi...
Definition: PassManagerBuilder.h:110
llvm::createLoopInstSimplifyPass
Pass * createLoopInstSimplifyPass()
Definition: LoopInstSimplify.cpp:245
LLVMPassManagerBuilderCreate
LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate()
See llvm::PassManagerBuilder.
Definition: PassManagerBuilder.cpp:802
llvm::createPromoteMemoryToRegisterPass
FunctionPass * createPromoteMemoryToRegisterPass()
Definition: Mem2Reg.cpp:114
llvm::createInstructionCombiningPass
FunctionPass * createInstructionCombiningPass()
Definition: InstructionCombining.cpp:4742
LLVMPassManagerBuilderPopulateModulePassManager
void LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)
See llvm::PassManagerBuilder::populateModulePassManager.
Definition: PassManagerBuilder.cpp:861
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:278
llvm::SimplifyCFGOptions
Definition: SimplifyCFGOptions.h:23
llvm::createLICMPass
Pass * createLICMPass()
Definition: LICM.cpp:343
llvm::PassManagerBuilder::DisableUnrollLoops
bool DisableUnrollLoops
Definition: PassManagerBuilder.h:155
llvm::createConstraintEliminationPass
FunctionPass * createConstraintEliminationPass()
Definition: ConstraintElimination.cpp:937
llvm::PassManagerBuilder::EP_EarlyAsPossible
@ EP_EarlyAsPossible
EP_EarlyAsPossible - This extension point allows adding passes before any other transformations,...
Definition: PassManagerBuilder.h:70
SmallVector.h
llvm::createLowerConstantIntrinsicsPass
FunctionPass * createLowerConstantIntrinsicsPass()
Definition: LowerConstantIntrinsics.cpp:203
llvm::createJumpThreadingPass
FunctionPass * createJumpThreadingPass(int Threshold=-1)
Definition: JumpThreading.cpp:171
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:97
llvm::createLoopFlattenPass
FunctionPass * createLoopFlattenPass()
Definition: LoopFlatten.cpp:970
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
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:1523
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:237
InstCombine.h
llvm::createSpeculativeExecutionIfHasBranchDivergencePass
FunctionPass * createSpeculativeExecutionIfHasBranchDivergencePass()
Definition: SpeculativeExecution.cpp:329
llvm::cl::desc
Definition: CommandLine.h:413
llvm::createLowerMatrixIntrinsicsMinimalPass
Pass * createLowerMatrixIntrinsicsMinimalPass()
Definition: LowerMatrixIntrinsics.cpp:2430
llvm::PassManagerBuilder::DivergentTarget
bool DivergentTarget
Definition: PassManagerBuilder.h:167
llvm::PassManagerBuilder::EP_CGSCCOptimizerLate
@ EP_CGSCCOptimizerLate
EP_CGSCCOptimizerLate - This extension point allows adding CallGraphSCC passes at the end of the main...
Definition: PassManagerBuilder.h:115
llvm::createFunctionSpecializationPass
ModulePass * createFunctionSpecializationPass()
createFunctionSpecializationPass - This pass propagates constants from call sites to the specialized ...
Definition: SCCP.cpp:196
llvm::SetLicmMssaOptCap
cl::opt< unsigned > SetLicmMssaOptCap
llvm::EnableGVNHoist
cl::opt< bool > EnableGVNHoist
llvm::createLoopDeletionPass
Pass * createLoopDeletionPass()
Definition: LoopDeletion.cpp:575
llvm::createSROAPass
FunctionPass * createSROAPass()
Definition: SROA.cpp:4832
MPM
ModulePassManager MPM
Definition: PassBuilderBindings.cpp:70
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
FunctionAttrs.h
llvm::EnableFunctionSpecialization
cl::opt< bool > EnableFunctionSpecialization
CFLSteensAliasAnalysis.h
llvm::createLoopUnrollAndJamPass
Pass * createLoopUnrollAndJamPass(int OptLevel=2)
Definition: LoopUnrollAndJamPass.cpp:531
llvm::createLoopVectorizePass
Pass * createLoopVectorizePass()
Definition: LoopVectorize.cpp:7358
GlobalExtensionsNotEmpty
static bool GlobalExtensionsNotEmpty()
Check if GlobalExtensions is constructed and not empty.
Definition: PassManagerBuilder.cpp:208
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:1449
llvm::createAnnotation2MetadataLegacyPass
ModulePass * createAnnotation2MetadataLegacyPass()
Definition: Annotation2Metadata.cpp:98
llvm::createOpenMPOptCGSCCLegacyPass
Pass * createOpenMPOptCGSCCLegacyPass()
createOpenMPOptLegacyPass - OpenMP specific optimizations.
Definition: OpenMPOpt.cpp:5287