LLVM  13.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"
34 #include "llvm/Transforms/IPO.h"
41 #include "llvm/Transforms/Scalar.h"
47 #include "llvm/Transforms/Utils.h"
52 
53 using namespace llvm;
54 
55 namespace llvm {
56 cl::opt<bool> RunPartialInlining("enable-partial-inlining", cl::init(false),
58  cl::desc("Run Partial inlinining pass"));
59 
60 static cl::opt<bool>
61 UseGVNAfterVectorization("use-gvn-after-vectorization",
62  cl::init(false), cl::Hidden,
63  cl::desc("Run GVN instead of Early CSE after vectorization passes"));
64 
66  "extra-vectorizer-passes", cl::init(false), cl::Hidden,
67  cl::desc("Run cleanup optimization passes after vectorization."));
68 
69 static cl::opt<bool>
70 RunLoopRerolling("reroll-loops", cl::Hidden,
71  cl::desc("Run the loop rerolling pass"));
72 
73 cl::opt<bool> RunNewGVN("enable-newgvn", cl::init(false), cl::Hidden,
74  cl::desc("Run the NewGVN pass"));
75 
76 // Experimental option to use CFL-AA
78  UseCFLAA("use-cfl-aa", cl::init(::CFLAAType::None), cl::Hidden,
79  cl::desc("Enable the new, experimental CFL alias analysis"),
80  cl::values(clEnumValN(::CFLAAType::None, "none", "Disable CFL-AA"),
82  "Enable unification-based CFL-AA"),
83  clEnumValN(::CFLAAType::Andersen, "anders",
84  "Enable inclusion-based CFL-AA"),
85  clEnumValN(::CFLAAType::Both, "both",
86  "Enable both variants of CFL-AA")));
87 
89  "enable-loopinterchange", cl::init(false), cl::Hidden,
90  cl::desc("Enable the experimental LoopInterchange Pass"));
91 
92 cl::opt<bool> EnableUnrollAndJam("enable-unroll-and-jam", cl::init(false),
93  cl::Hidden,
94  cl::desc("Enable Unroll And Jam Pass"));
95 
96 cl::opt<bool> EnableLoopFlatten("enable-loop-flatten", cl::init(false),
97  cl::Hidden,
98  cl::desc("Enable the LoopFlatten Pass"));
99 
100 static cl::opt<bool>
101  EnablePrepareForThinLTO("prepare-for-thinlto", cl::init(false), cl::Hidden,
102  cl::desc("Enable preparation for ThinLTO."));
103 
104 static cl::opt<bool>
105  EnablePerformThinLTO("perform-thinlto", cl::init(false), cl::Hidden,
106  cl::desc("Enable performing ThinLTO."));
107 
108 cl::opt<bool> EnableHotColdSplit("hot-cold-split", cl::init(false),
109  cl::ZeroOrMore, cl::desc("Enable hot-cold splitting pass"));
110 
111 cl::opt<bool> EnableIROutliner("ir-outliner", cl::init(false), cl::Hidden,
112  cl::desc("Enable ir outliner pass"));
113 
115  "enable-loop-versioning-licm", cl::init(false), cl::Hidden,
116  cl::desc("Enable the experimental Loop Versioning LICM pass"));
117 
119  DisablePreInliner("disable-preinline", cl::init(false), cl::Hidden,
120  cl::desc("Disable pre-instrumentation inliner"));
121 
123  "preinline-threshold", cl::Hidden, cl::init(75), cl::ZeroOrMore,
124  cl::desc("Control the amount of inlining in pre-instrumentation inliner "
125  "(default = 75)"));
126 
128  EnableGVNHoist("enable-gvn-hoist", cl::init(false), cl::ZeroOrMore,
129  cl::desc("Enable the GVN hoisting pass (default = off)"));
130 
131 static cl::opt<bool>
132  DisableLibCallsShrinkWrap("disable-libcalls-shrinkwrap", cl::init(false),
133  cl::Hidden,
134  cl::desc("Disable shrink-wrap library calls"));
135 
137  "enable-simple-loop-unswitch", cl::init(false), cl::Hidden,
138  cl::desc("Enable the simple loop unswitch pass. Also enables independent "
139  "cleanup passes integrated into the loop pass manager pipeline."));
140 
142  EnableGVNSink("enable-gvn-sink", cl::init(false), cl::ZeroOrMore,
143  cl::desc("Enable the GVN sinking pass (default = off)"));
144 
145 // This option is used in simplifying testing SampleFDO optimizations for
146 // profile loading.
148  EnableCHR("enable-chr", cl::init(true), cl::Hidden,
149  cl::desc("Enable control height reduction optimization (CHR)"));
150 
152  "flattened-profile-used", cl::init(false), cl::Hidden,
153  cl::desc("Indicate the sample profile being used is flattened, i.e., "
154  "no inline hierachy exists in the profile. "));
155 
157  "enable-order-file-instrumentation", cl::init(false), cl::Hidden,
158  cl::desc("Enable order file instrumentation (default = off)"));
159 
161  "enable-matrix", cl::init(false), cl::Hidden,
162  cl::desc("Enable lowering of the matrix intrinsics"));
163 
165  "enable-constraint-elimination", cl::init(false), cl::Hidden,
166  cl::desc(
167  "Enable pass to eliminate conditions based on linear constraints."));
168 
170  "attributor-enable", cl::Hidden, cl::init(AttributorRunOption::NONE),
171  cl::desc("Enable the attributor inter-procedural deduction pass."),
173  "enable all attributor runs"),
175  "enable module-wide attributor runs"),
177  "enable call graph SCC attributor runs"),
179  "disable attributor runs")));
180 
182 } // namespace llvm
183 
185  OptLevel = 2;
186  SizeLevel = 0;
187  LibraryInfo = nullptr;
188  Inliner = nullptr;
189  DisableUnrollLoops = false;
190  SLPVectorize = false;
191  LoopVectorize = true;
192  LoopsInterleaved = true;
194  NewGVN = RunNewGVN;
197  DisableGVNLoadPRE = false;
199  VerifyInput = false;
200  VerifyOutput = false;
201  MergeFunctions = false;
202  PrepareForLTO = false;
203  EnablePGOInstrGen = false;
204  EnablePGOCSInstrGen = false;
205  EnablePGOCSInstrUse = false;
206  PGOInstrGen = "";
207  PGOInstrUse = "";
208  PGOSampleUse = "";
211  DivergentTarget = false;
212  CallGraphProfile = true;
213 }
214 
216  delete LibraryInfo;
217  delete Inliner;
218 }
219 
220 /// Set of global extensions, automatically added as part of the standard set.
221 static ManagedStatic<
225  8>>
228 
229 /// Check if GlobalExtensions is constructed and not empty.
230 /// Since GlobalExtensions is a managed static, calling 'empty()' will trigger
231 /// the construction of the object.
233  return GlobalExtensions.isConstructed() && !GlobalExtensions->empty();
234 }
235 
239  auto ExtensionID = GlobalExtensionsCounter++;
240  GlobalExtensions->push_back(std::make_tuple(Ty, std::move(Fn), ExtensionID));
241  return ExtensionID;
242 }
243 
246  // RegisterStandardPasses may try to call this function after GlobalExtensions
247  // has already been destroyed; doing so should not generate an error.
248  if (!GlobalExtensions.isConstructed())
249  return;
250 
251  auto GlobalExtension =
252  llvm::find_if(*GlobalExtensions, [ExtensionID](const auto &elem) {
253  return std::get<2>(elem) == ExtensionID;
254  });
255  assert(GlobalExtension != GlobalExtensions->end() &&
256  "The extension ID to be removed should always be valid.");
257 
258  GlobalExtensions->erase(GlobalExtension);
259 }
260 
262  Extensions.push_back(std::make_pair(Ty, std::move(Fn)));
263 }
264 
265 void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy,
266  legacy::PassManagerBase &PM) const {
267  if (GlobalExtensionsNotEmpty()) {
268  for (auto &Ext : *GlobalExtensions) {
269  if (std::get<0>(Ext) == ETy)
270  std::get<1>(Ext)(*this, PM);
271  }
272  }
273  for (unsigned i = 0, e = Extensions.size(); i != e; ++i)
274  if (Extensions[i].first == ETy)
275  Extensions[i].second(*this, PM);
276 }
277 
278 void PassManagerBuilder::addInitialAliasAnalysisPasses(
279  legacy::PassManagerBase &PM) const {
280  switch (UseCFLAA) {
281  case ::CFLAAType::Steensgaard:
283  break;
284  case ::CFLAAType::Andersen:
286  break;
287  case ::CFLAAType::Both:
290  break;
291  default:
292  break;
293  }
294 
295  // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
296  // BasicAliasAnalysis wins if they disagree. This is intended to help
297  // support "obvious" type-punning idioms.
300 }
301 
304  addExtensionsToPM(EP_EarlyAsPossible, FPM);
305 
306  // Add LibraryInfo if we have some.
307  if (LibraryInfo)
309 
310  // The backends do not handle matrix intrinsics currently.
311  // Make sure they are also lowered in O0.
312  // FIXME: A lightweight version of the pass should run in the backend
313  // pipeline on demand.
314  if (EnableMatrix && OptLevel == 0)
316 
317  if (OptLevel == 0) return;
318 
319  addInitialAliasAnalysisPasses(FPM);
320 
321  // Lower llvm.expect to metadata before attempting transforms.
322  // Compare/branch metadata may alter the behavior of passes like SimplifyCFG.
325  FPM.add(createSROAPass());
326  FPM.add(createEarlyCSEPass());
327 }
328 
329 // Do PGO instrumentation generation or use pass as the option specified.
330 void PassManagerBuilder::addPGOInstrPasses(legacy::PassManagerBase &MPM,
331  bool IsCS = false) {
332  if (IsCS) {
334  return;
335  } else if (!EnablePGOInstrGen && PGOInstrUse.empty() && PGOSampleUse.empty())
336  return;
337 
338  // Perform the preinline and cleanup passes for O1 and above.
339  // We will not do this inline for context sensitive PGO (when IsCS is true).
340  if (OptLevel > 0 && !DisablePreInliner && PGOSampleUse.empty() && !IsCS) {
341  // Create preinline pass. We construct an InlineParams object and specify
342  // the threshold here to avoid the command line options of the regular
343  // inliner to influence pre-inlining. The only fields of InlineParams we
344  // care about are DefaultThreshold and HintThreshold.
346  IP.DefaultThreshold = PreInlineThreshold;
347  // FIXME: The hint threshold has the same value used by the regular inliner
348  // when not optimzing for size. This should probably be lowered after
349  // performance testing.
350  // Use PreInlineThreshold for both -Os and -Oz. Not running preinliner makes
351  // the instrumented binary unusably large. Even if PreInlineThreshold is not
352  // correct thresold for -Oz, it is better than not running preinliner.
353  IP.HintThreshold = SizeLevel > 0 ? PreInlineThreshold : 325;
354 
356  MPM.add(createSROAPass());
357  MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
358  MPM.add(createCFGSimplificationPass()); // Merge & remove BBs
359  MPM.add(createInstructionCombiningPass()); // Combine silly seq's
360  addExtensionsToPM(EP_Peephole, MPM);
361  }
362  if ((EnablePGOInstrGen && !IsCS) || (EnablePGOCSInstrGen && IsCS)) {
364  // Add the profile lowering pass.
366  if (!PGOInstrGen.empty())
367  Options.InstrProfileOutput = PGOInstrGen;
368  Options.DoCounterPromotion = true;
369  Options.UseBFIInPromotion = IsCS;
370  MPM.add(createLoopRotatePass());
372  }
373  if (!PGOInstrUse.empty())
375  // Indirect call promotion that promotes intra-module targets only.
376  // For ThinLTO this is done earlier due to interactions with globalopt
377  // for imported functions. We don't run this at -O0.
378  if (OptLevel > 0 && !IsCS)
379  MPM.add(
381 }
382 void PassManagerBuilder::addFunctionSimplificationPasses(
384  // Start of function pass.
385  // Break up aggregate allocas, using SSAUpdater.
386  assert(OptLevel >= 1 && "Calling function optimizer with no optimization level!");
387  MPM.add(createSROAPass());
388  MPM.add(createEarlyCSEPass(true /* Enable mem-ssa. */)); // Catch trivial redundancies
391 
392  if (OptLevel > 1) {
393  if (EnableGVNHoist)
394  MPM.add(createGVNHoistPass());
395  if (EnableGVNSink) {
396  MPM.add(createGVNSinkPass());
398  }
399  }
400 
403 
404  if (OptLevel > 1) {
405  // Speculative execution if the target has divergent branches; otherwise nop.
407 
408  MPM.add(createJumpThreadingPass()); // Thread jumps.
409  MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals
410  }
411  MPM.add(createCFGSimplificationPass()); // Merge & remove BBs
412  // Combine silly seq's
413  if (OptLevel > 2)
418  addExtensionsToPM(EP_Peephole, MPM);
419 
420  // Optimize memory intrinsic calls based on the profiled size information.
421  if (SizeLevel == 0)
423 
424  // TODO: Investigate the cost/benefit of tail call elimination on debugging.
425  if (OptLevel > 1)
426  MPM.add(createTailCallEliminationPass()); // Eliminate tail calls
427  MPM.add(createCFGSimplificationPass()); // Merge & remove BBs
428  MPM.add(createReassociatePass()); // Reassociate expressions
429 
430  // Begin the loop pass pipeline.
432  // The simple loop unswitch pass relies on separate cleanup passes. Schedule
433  // them first so when we re-process a loop they run before other loop
434  // passes.
437  }
438  // Try to remove as much code from the loop header as possible,
439  // to reduce amount of IR that will have to be duplicated.
440  // TODO: Investigate promotion cap for O1.
442  // Rotate Loop - disable header duplication at -Oz
443  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, PrepareForLTO));
444  // TODO: Investigate promotion cap for O1.
448  else
450  // FIXME: We break the loop pass pipeline here in order to do full
451  // simplify-cfg. Eventually loop-simplifycfg should be enhanced to replace the
452  // need for this.
455  // We resume loop passes creating a second loop pipeline here.
456  if (EnableLoopFlatten) {
457  MPM.add(createLoopFlattenPass()); // Flatten loops
459  }
460  MPM.add(createLoopIdiomPass()); // Recognize idioms like memset.
461  MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars
462  addExtensionsToPM(EP_LateLoopOptimizations, MPM);
463  MPM.add(createLoopDeletionPass()); // Delete dead loops
464 
466  MPM.add(createLoopInterchangePass()); // Interchange loops
467 
468  // Unroll small loops and perform peeling.
471  addExtensionsToPM(EP_LoopOptimizerEnd, MPM);
472  // This ends the loop pass pipelines.
473 
474  // Break up allocas that may now be splittable after loop unrolling.
475  MPM.add(createSROAPass());
476 
477  if (OptLevel > 1) {
478  MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds
479  MPM.add(NewGVN ? createNewGVNPass()
480  : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
481  }
482  MPM.add(createSCCPPass()); // Constant prop with SCCP
483 
486 
487  // Delete dead bit computations (instcombine runs after to fold away the dead
488  // computations, and then ADCE will run later to exploit any new DCE
489  // opportunities that creates).
490  MPM.add(createBitTrackingDCEPass()); // Delete dead bit computations
491 
492  // Run instcombine after redundancy elimination to exploit opportunities
493  // opened up by them.
495  addExtensionsToPM(EP_Peephole, MPM);
496  if (OptLevel > 1) {
497  MPM.add(createJumpThreadingPass()); // Thread jumps
499  }
500  MPM.add(createAggressiveDCEPass()); // Delete dead instructions
501 
502  MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset
503  // TODO: Investigate if this is too expensive at O1.
504  if (OptLevel > 1) {
505  MPM.add(createDeadStoreEliminationPass()); // Delete dead stores
507  }
508 
509  addExtensionsToPM(EP_ScalarOptimizerLate, MPM);
510 
511  if (RerollLoops)
512  MPM.add(createLoopRerollPass());
513 
514  // Merge & remove BBs and sink & hoist common instructions.
516  SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true)));
517  // Clean up after everything.
519  addExtensionsToPM(EP_Peephole, MPM);
520 
521  if (EnableCHR && OptLevel >= 3 &&
522  (!PGOInstrUse.empty() || !PGOSampleUse.empty() || EnablePGOCSInstrGen))
524 }
525 
526 /// FIXME: Should LTO cause any differences to this set of passes?
527 void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
528  bool IsLTO) {
530 
531  if (IsLTO) {
532  // The vectorizer may have significantly shortened a loop body; unroll
533  // again. Unroll small loops to hide loop backedge latency and saturate any
534  // parallel execution resources of an out-of-order processor. We also then
535  // need to clean up redundancies and loop invariant code.
536  // FIXME: It would be really good to use a loop-integrated instruction
537  // combiner for cleanup here so that the unrolling and LICM can be pipelined
538  // across the loop nests.
539  // We do UnrollAndJam in a separate LPM to ensure it happens before unroll
545  }
546 
547  if (!IsLTO) {
548  // Eliminate loads by forwarding stores from the previous iteration to loads
549  // of the current iteration.
551  }
552  // Cleanup after the loop optimization passes.
554 
555  if (OptLevel > 1 && ExtraVectorizerPasses) {
556  // At higher optimization levels, try to clean up any runtime overlap and
557  // alignment checks inserted by the vectorizer. We want to track correlated
558  // runtime checks for two inner loops in the same outer loop, fold any
559  // common computations, hoist loop-invariant aspects out of any outer loop,
560  // and unswitch the runtime checks if possible. Once hoisted, we may have
561  // dead (or speculatable) control flows or more combining opportunities.
562  PM.add(createEarlyCSEPass());
569  }
570 
571  if (IsLTO) {
573  .hoistCommonInsts(true)));
574  } else {
575  // Now that we've formed fast to execute loop structures, we do further
576  // optimizations. These are run afterward as they might block doing complex
577  // analyses and transforms such as what are needed for loop vectorization.
578 
579  // Cleanup after loop vectorization, etc. Simplification passes like CVP and
580  // GVN, loop transforms, and others have already run, so it's now better to
581  // convert to more optimized IR using more aggressive simplify CFG options.
582  // The extra sinking transform can create larger basic blocks, so do this
583  // before SLP vectorization.
585  .forwardSwitchCondToPhi(true)
586  .convertSwitchToLookupTable(true)
587  .needCanonicalLoops(false)
588  .hoistCommonInsts(true)
589  .sinkCommonInsts(true)));
590  }
591  if (IsLTO) {
592  PM.add(createSCCPPass()); // Propagate exposed constants
593  PM.add(createInstructionCombiningPass()); // Clean up again
595  }
596 
597  // Optimize parallel scalar instruction chains into SIMD instructions.
598  if (SLPVectorize) {
600  if (OptLevel > 1 && ExtraVectorizerPasses)
601  PM.add(createEarlyCSEPass());
602  }
603 
604  // Enhance/cleanup vector code.
606 
607  if (!IsLTO) {
608  addExtensionsToPM(EP_Peephole, PM);
610 
612  // Unroll and Jam. We do this before unroll but need to be in a separate
613  // loop pass manager in order for the outer loop to be processed by
614  // unroll and jam before the inner loop is unrolled.
616  }
617 
618  // Unroll small loops
621 
622  if (!DisableUnrollLoops) {
623  // LoopUnroll may generate some redundency to cleanup.
625 
626  // Runtime unrolling will introduce runtime check in loop prologue. If the
627  // unrolled loop is a inner loop, then the prologue will be inside the
628  // outer loop. LICM pass can help to promote the runtime check out if the
629  // checked value is loop invariant.
631  }
632 
634  }
635 
636  // After vectorization and unrolling, assume intrinsics may tell us more
637  // about pointer alignments.
639 
640  if (IsLTO)
642 }
643 
646  // Whether this is a default or *LTO pre-link pipeline. The FullLTO post-link
647  // is handled separately, so just check this is not the ThinLTO post-link.
648  bool DefaultOrPreLinkPipeline = !PerformThinLTO;
649 
651 
652  if (!PGOSampleUse.empty()) {
653  MPM.add(createPruneEHPass());
654  // In ThinLTO mode, when flattened profile is used, all the available
655  // profile information will be annotated in PreLink phase so there is
656  // no need to load the profile again in PostLink.
659  }
660 
661  // Allow forcing function attributes as a debugging and tuning aid.
663 
664  // If all optimizations are disabled, just run the always-inline pass and,
665  // if enabled, the function merging pass.
666  if (OptLevel == 0) {
667  addPGOInstrPasses(MPM);
668  if (Inliner) {
669  MPM.add(Inliner);
670  Inliner = nullptr;
671  }
672 
673  // FIXME: The BarrierNoopPass is a HACK! The inliner pass above implicitly
674  // creates a CGSCC pass manager, but we don't want to add extensions into
675  // that pass manager. To prevent this we insert a no-op module pass to reset
676  // the pass manager to get the same behavior as EP_OptimizerLast in non-O0
677  // builds. The function merging pass is
678  if (MergeFunctions)
680  else if (GlobalExtensionsNotEmpty() || !Extensions.empty())
681  MPM.add(createBarrierNoopPass());
682 
683  if (PerformThinLTO) {
684  MPM.add(createLowerTypeTestsPass(nullptr, nullptr, true));
685  // Drop available_externally and unreferenced globals. This is necessary
686  // with ThinLTO in order to avoid leaving undefined references to dead
687  // globals in the object file.
689  MPM.add(createGlobalDCEPass());
690  }
691 
692  addExtensionsToPM(EP_EnabledOnOptLevel0, MPM);
693 
696  // Rename anon globals to be able to export them in the summary.
697  // This has to be done after we add the extensions to the pass manager
698  // as there could be passes (e.g. Adddress sanitizer) which introduce
699  // new unnamed globals.
701  }
702 
704  return;
705  }
706 
707  // Add LibraryInfo if we have some.
708  if (LibraryInfo)
710 
711  addInitialAliasAnalysisPasses(MPM);
712 
713  // For ThinLTO there are two passes of indirect call promotion. The
714  // first is during the compile phase when PerformThinLTO=false and
715  // intra-module indirect call targets are promoted. The second is during
716  // the ThinLTO backend when PerformThinLTO=true, when we promote imported
717  // inter-module indirect calls. For that we perform indirect call promotion
718  // earlier in the pass pipeline, here before globalopt. Otherwise imported
719  // available_externally functions look unreferenced and are removed.
720  if (PerformThinLTO) {
721  MPM.add(createPGOIndirectCallPromotionLegacyPass(/*InLTO = */ true,
722  !PGOSampleUse.empty()));
723  MPM.add(createLowerTypeTestsPass(nullptr, nullptr, true));
724  }
725 
726  // For SamplePGO in ThinLTO compile phase, we do not want to unroll loops
727  // as it will change the CFG too much to make the 2nd profile annotation
728  // in backend more difficult.
729  bool PrepareForThinLTOUsingPGOSampleProfile =
730  PrepareForThinLTO && !PGOSampleUse.empty();
731  if (PrepareForThinLTOUsingPGOSampleProfile)
732  DisableUnrollLoops = true;
733 
734  // Infer attributes about declarations if possible.
736 
737  // Infer attributes on declarations, call sites, arguments, etc.
740 
741  addExtensionsToPM(EP_ModuleOptimizerEarly, MPM);
742 
743  if (OptLevel > 2)
745 
746  MPM.add(createIPSCCPPass()); // IP SCCP
748 
749  MPM.add(createGlobalOptimizerPass()); // Optimize out global vars
750  // Promote any localized global vars.
752 
753  MPM.add(createDeadArgEliminationPass()); // Dead argument elimination
754 
755  MPM.add(createInstructionCombiningPass()); // Clean up after IPCP & DAE
756  addExtensionsToPM(EP_Peephole, MPM);
757  MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE
758 
759  // For SamplePGO in ThinLTO compile phase, we do not want to do indirect
760  // call promotion as it will change the CFG too much to make the 2nd
761  // profile annotation in backend more difficult.
762  // PGO instrumentation is added during the compile phase for ThinLTO, do
763  // not run it a second time
764  if (DefaultOrPreLinkPipeline && !PrepareForThinLTOUsingPGOSampleProfile)
765  addPGOInstrPasses(MPM);
766 
767  // Create profile COMDAT variables. Lld linker wants to see all variables
768  // before the LTO/ThinLTO link since it needs to resolve symbols/comdats.
771 
772  // We add a module alias analysis pass here. In part due to bugs in the
773  // analysis infrastructure this "works" in that the analysis stays alive
774  // for the entire SCC pass run below.
776 
777  // Start of CallGraph SCC passes.
778  MPM.add(createPruneEHPass()); // Remove dead EH info
779  bool RunInliner = false;
780  if (Inliner) {
781  MPM.add(Inliner);
782  Inliner = nullptr;
783  RunInliner = true;
784  }
785 
786  // Infer attributes on declarations, call sites, arguments, etc. for an SCC.
789 
790  // Try to perform OpenMP specific optimizations. This is a (quick!) no-op if
791  // there are no OpenMP runtime calls present in the module.
792  if (OptLevel > 1)
794 
796  if (OptLevel > 2)
797  MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args
798 
799  addExtensionsToPM(EP_CGSCCOptimizerLate, MPM);
800  addFunctionSimplificationPasses(MPM);
801 
802  // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC
803  // pass manager that we are specifically trying to avoid. To prevent this
804  // we must insert a no-op module pass to reset the pass manager.
805  MPM.add(createBarrierNoopPass());
806 
807  if (RunPartialInlining)
809 
810  if (OptLevel > 1 && !PrepareForLTO && !PrepareForThinLTO)
811  // Remove avail extern fns and globals definitions if we aren't
812  // compiling an object file for later LTO. For LTO we want to preserve
813  // these so they are eligible for inlining at link-time. Note if they
814  // are unreferenced they will be removed by GlobalDCE later, so
815  // this only impacts referenced available externally globals.
816  // Eventually they will be suppressed during codegen, but eliminating
817  // here enables more opportunity for GlobalDCE as it may make
818  // globals referenced by available external functions dead
819  // and saves running remaining passes on the eliminated functions.
821 
822  // CSFDO instrumentation and use pass. Don't invoke this for Prepare pass
823  // for LTO and ThinLTO -- The actual pass will be called after all inlines
824  // are performed.
825  // Need to do this after COMDAT variables have been eliminated,
826  // (i.e. after EliminateAvailableExternallyPass).
828  addPGOInstrPasses(MPM, /* IsCS */ true);
829 
832 
834 
835  // The inliner performs some kind of dead code elimination as it goes,
836  // but there are cases that are not really caught by it. We might
837  // at some point consider teaching the inliner about them, but it
838  // is OK for now to run GlobalOpt + GlobalDCE in tandem as their
839  // benefits generally outweight the cost, making the whole pipeline
840  // faster.
841  if (RunInliner) {
843  MPM.add(createGlobalDCEPass());
844  }
845 
846  // If we are planning to perform ThinLTO later, let's not bloat the code with
847  // unrolling/vectorization/... now. We'll first run the inliner + CGSCC passes
848  // during ThinLTO and perform the rest of the optimizations afterward.
849  if (PrepareForThinLTO) {
850  // Ensure we perform any last passes, but do so before renaming anonymous
851  // globals in case the passes add any.
852  addExtensionsToPM(EP_OptimizerLast, MPM);
854  // Rename anon globals to be able to export them in the summary.
856  return;
857  }
858 
859  if (PerformThinLTO)
860  // Optimize globals now when performing ThinLTO, this enables more
861  // optimizations later.
863 
864  // Scheduling LoopVersioningLICM when inlining is over, because after that
865  // we may see more accurate aliasing. Reason to run this late is that too
866  // early versioning may prevent further inlining due to increase of code
867  // size. By placing it just after inlining other optimizations which runs
868  // later might get benefit of no-alias assumption in clone loop.
869  if (UseLoopVersioningLICM) {
870  MPM.add(createLoopVersioningLICMPass()); // Do LoopVersioningLICM
872  }
873 
874  // We add a fresh GlobalsModRef run at this point. This is particularly
875  // useful as the above will have inlined, DCE'ed, and function-attr
876  // propagated everything. We should at this point have a reasonably minimal
877  // and richly annotated call graph. By computing aliasing and mod/ref
878  // information for all local globals here, the late loop passes and notably
879  // the vectorizer will be able to use them to help recognize vectorizable
880  // memory operations.
881  //
882  // Note that this relies on a bug in the pass manager which preserves
883  // a module analysis into a function pass pipeline (and throughout it) so
884  // long as the first function pass doesn't invalidate the module analysis.
885  // Thus both Float2Int and LoopRotate have to preserve AliasAnalysis for
886  // this to work. Fortunately, it is trivial to preserve AliasAnalysis
887  // (doing nothing preserves it as it is required to be conservatively
888  // correct in the face of IR changes).
890 
891  MPM.add(createFloat2IntPass());
893 
894  if (EnableMatrix) {
896  // CSE the pointer arithmetic of the column vectors. This allows alias
897  // analysis to establish no-aliasing between loads and stores of different
898  // columns of the same matrix.
899  MPM.add(createEarlyCSEPass(false));
900  }
901 
902  addExtensionsToPM(EP_VectorizerStart, MPM);
903 
904  // Re-rotate loops in all our loop nests. These may have fallout out of
905  // rotated form due to GVN or other transformations, and the vectorizer relies
906  // on the rotated form. Disable header duplication at -Oz.
907  MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, PrepareForLTO));
908 
909  // Distribute loops to allow partial vectorization. I.e. isolate dependences
910  // into separate loop that would otherwise inhibit vectorization. This is
911  // currently only performed for loops marked with the metadata
912  // llvm.loop.distribute=true or when -enable-loop-distribute is specified.
914 
915  addVectorPasses(MPM, /* IsLTO */ false);
916 
917  // FIXME: We shouldn't bother with this anymore.
918  MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes
919 
920  // GlobalOpt already deletes dead functions and globals, at -O2 try a
921  // late pass of GlobalDCE. It is capable of deleting dead cycles.
922  if (OptLevel > 1) {
923  MPM.add(createGlobalDCEPass()); // Remove dead fns and globals.
924  MPM.add(createConstantMergePass()); // Merge dup global constants
925  }
926 
927  // See comment in the new PM for justification of scheduling splitting at
928  // this stage (\ref buildModuleSimplificationPipeline).
931 
932  if (EnableIROutliner)
933  MPM.add(createIROutlinerPass());
934 
935  if (MergeFunctions)
937 
938  // Add Module flag "CG Profile" based on Branch Frequency Information.
939  if (CallGraphProfile)
941 
942  // LoopSink pass sinks instructions hoisted by LICM, which serves as a
943  // canonicalization pass that enables other optimizations. As a result,
944  // LoopSink pass needs to be a very late IR pass to avoid undoing LICM
945  // result too early.
946  MPM.add(createLoopSinkPass());
947  // Get rid of LCSSA nodes.
949 
950  // This hoists/decomposes div/rem ops. It should run after other sink/hoist
951  // passes to avoid re-sinking, but before SimplifyCFG because it can allow
952  // flattening of blocks.
953  MPM.add(createDivRemPairsPass());
954 
955  // LoopSink (and other loop passes since the last simplifyCFG) might have
956  // resulted in single-entry-single-exit or empty blocks. Clean up the CFG.
958 
959  addExtensionsToPM(EP_OptimizerLast, MPM);
960 
961  if (PrepareForLTO) {
963  // Rename anon globals to be able to handle them in the summary
965  }
966 
968 }
969 
970 void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
971  // Load sample profile before running the LTO optimization pipeline.
972  if (!PGOSampleUse.empty()) {
973  PM.add(createPruneEHPass());
975  }
976 
977  // Remove unused virtual tables to improve the quality of code generated by
978  // whole-program devirtualization and bitset lowering.
979  PM.add(createGlobalDCEPass());
980 
981  // Provide AliasAnalysis services for optimizations.
982  addInitialAliasAnalysisPasses(PM);
983 
984  // Allow forcing function attributes as a debugging and tuning aid.
986 
987  // Infer attributes about declarations if possible.
989 
990  if (OptLevel > 1) {
991  // Split call-site with more constrained arguments.
993 
994  // Indirect call promotion. This should promote all the targets that are
995  // left by the earlier promotion pass that promotes intra-module targets.
996  // This two-step promotion is to save the compile time. For LTO, it should
997  // produce the same result as if we only do promotion here.
998  PM.add(
1000 
1001  // Propagate constants at call sites into the functions they call. This
1002  // opens opportunities for globalopt (and inlining) by substituting function
1003  // pointers passed as arguments to direct uses of functions.
1004  PM.add(createIPSCCPPass());
1005 
1006  // Attach metadata to indirect call sites indicating the set of functions
1007  // they may target at run-time. This should follow IPSCCP.
1009 
1010  // Infer attributes on declarations, call sites, arguments, etc.
1013  }
1014 
1015  // Infer attributes about definitions. The readnone attribute in particular is
1016  // required for virtual constant propagation.
1019 
1020  // Split globals using inrange annotations on GEP indices. This can help
1021  // improve the quality of generated code when virtual constant propagation or
1022  // control flow integrity are enabled.
1023  PM.add(createGlobalSplitPass());
1024 
1025  // Apply whole-program devirtualization and virtual constant propagation.
1027 
1028  // That's all we need at opt level 1.
1029  if (OptLevel == 1)
1030  return;
1031 
1032  // Now that we internalized some globals, see if we can hack on them!
1034  // Promote any localized global vars.
1036 
1037  // Linking modules together can lead to duplicated global constants, only
1038  // keep one copy of each constant.
1040 
1041  // Remove unused arguments from functions.
1043 
1044  // Reduce the code after globalopt and ipsccp. Both can open up significant
1045  // simplification opportunities, and both can propagate functions through
1046  // function pointers. When this happens, we often have to resolve varargs
1047  // calls, etc, so let instcombine do this.
1048  if (OptLevel > 2)
1051  addExtensionsToPM(EP_Peephole, PM);
1052 
1053  // Inline small functions
1054  bool RunInliner = Inliner;
1055  if (RunInliner) {
1056  PM.add(Inliner);
1057  Inliner = nullptr;
1058  }
1059 
1060  PM.add(createPruneEHPass()); // Remove dead EH info.
1061 
1062  // CSFDO instrumentation and use pass.
1063  addPGOInstrPasses(PM, /* IsCS */ true);
1064 
1065  // Infer attributes on declarations, call sites, arguments, etc. for an SCC.
1068 
1069  // Try to perform OpenMP specific optimizations. This is a (quick!) no-op if
1070  // there are no OpenMP runtime calls present in the module.
1071  if (OptLevel > 1)
1073 
1074  // Optimize globals again if we ran the inliner.
1075  if (RunInliner)
1077  PM.add(createGlobalDCEPass()); // Remove dead functions.
1078 
1079  // If we didn't decide to inline a function, check to see if we can
1080  // transform it to pass arguments by value instead of by reference.
1082 
1083  // The IPO passes may leave cruft around. Clean up after them.
1085  addExtensionsToPM(EP_Peephole, PM);
1086  PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true));
1087 
1088  // Break up allocas
1089  PM.add(createSROAPass());
1090 
1091  // LTO provides additional opportunities for tailcall elimination due to
1092  // link-time inlining, and visibility of nocapture attribute.
1093  if (OptLevel > 1)
1095 
1096  // Infer attributes on declarations, call sites, arguments, etc.
1097  PM.add(createPostOrderFunctionAttrsLegacyPass()); // Add nocapture.
1098  // Run a few AA driven optimizations here and now, to cleanup the code.
1099  PM.add(createGlobalsAAWrapperPass()); // IP alias analysis.
1100 
1102  PM.add(NewGVN ? createNewGVNPass()
1103  : createGVNPass(DisableGVNLoadPRE)); // Remove redundancies.
1104  PM.add(createMemCpyOptPass()); // Remove dead memcpys.
1105 
1106  // Nuke dead stores.
1108  PM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds.
1109 
1110  // More loops are countable; try to optimize them.
1111  if (EnableLoopFlatten)
1112  PM.add(createLoopFlattenPass());
1117 
1120 
1121  // Unroll small loops and perform peeling.
1125 
1126  addVectorPasses(PM, /* IsLTO */ true);
1127 
1128  addExtensionsToPM(EP_Peephole, PM);
1129 
1130  PM.add(createJumpThreadingPass(/*FreezeSelectCond*/ true));
1131 }
1132 
1133 void PassManagerBuilder::addLateLTOOptimizationPasses(
1135  // See comment in the new PM for justification of scheduling splitting at
1136  // this stage (\ref buildLTODefaultPipeline).
1137  if (EnableHotColdSplit)
1139 
1140  // Delete basic blocks, which optimization passes may have killed.
1141  PM.add(
1142  createCFGSimplificationPass(SimplifyCFGOptions().hoistCommonInsts(true)));
1143 
1144  // Drop bodies of available externally objects to improve GlobalDCE.
1146 
1147  // Now that we have optimized the program, discard unreachable functions.
1148  PM.add(createGlobalDCEPass());
1149 
1150  // FIXME: this is profitable (for compiler time) to do at -O0 too, but
1151  // currently it damages debug info.
1152  if (MergeFunctions)
1154 }
1155 
1158  PerformThinLTO = true;
1159  if (LibraryInfo)
1161 
1162  if (VerifyInput)
1163  PM.add(createVerifierPass());
1164 
1165  if (ImportSummary) {
1166  // This pass imports type identifier resolutions for whole-program
1167  // devirtualization and CFI. It must run early because other passes may
1168  // disturb the specific instruction patterns that these passes look for,
1169  // creating dependencies on resolutions that may not appear in the summary.
1170  //
1171  // For example, GVN may transform the pattern assume(type.test) appearing in
1172  // two basic blocks into assume(phi(type.test, type.test)), which would
1173  // transform a dependency on a WPD resolution into a dependency on a type
1174  // identifier resolution for CFI.
1175  //
1176  // Also, WPD has access to more precise information than ICP and can
1177  // devirtualize more effectively, so it should operate on the IR first.
1180  }
1181 
1183 
1184  if (VerifyOutput)
1185  PM.add(createVerifierPass());
1186  PerformThinLTO = false;
1187 }
1188 
1190  if (LibraryInfo)
1192 
1193  if (VerifyInput)
1194  PM.add(createVerifierPass());
1195 
1196  addExtensionsToPM(EP_FullLinkTimeOptimizationEarly, PM);
1197 
1198  if (OptLevel != 0)
1199  addLTOOptimizationPasses(PM);
1200  else {
1201  // The whole-program-devirt pass needs to run at -O0 because only it knows
1202  // about the llvm.type.checked.load intrinsic: it needs to both lower the
1203  // intrinsic itself and handle it in the summary.
1205  }
1206 
1207  // Create a function that performs CFI checks for cross-DSO calls with targets
1208  // in the current module.
1209  PM.add(createCrossDSOCFIPass());
1210 
1211  // Lower type metadata and the type.test intrinsic. This pass supports Clang's
1212  // control flow integrity mechanisms (-fsanitize=cfi*) and needs to run at
1213  // link time if CFI is enabled. The pass does nothing if CFI is disabled.
1215  // Run a second time to clean up any type tests left behind by WPD for use
1216  // in ICP (which is performed earlier than this in the regular LTO pipeline).
1217  PM.add(createLowerTypeTestsPass(nullptr, nullptr, true));
1218 
1219  if (OptLevel != 0)
1220  addLateLTOOptimizationPasses(PM);
1221 
1222  addExtensionsToPM(EP_FullLinkTimeOptimizationLast, PM);
1223 
1225 
1226  if (VerifyOutput)
1227  PM.add(createVerifierPass());
1228 }
1229 
1232  return wrap(PMB);
1233 }
1234 
1237  delete Builder;
1238 }
1239 
1240 void
1242  unsigned OptLevel) {
1244  Builder->OptLevel = OptLevel;
1245 }
1246 
1247 void
1249  unsigned SizeLevel) {
1251  Builder->SizeLevel = SizeLevel;
1252 }
1253 
1254 void
1256  LLVMBool Value) {
1257  // NOTE: The DisableUnitAtATime switch has been removed.
1258 }
1259 
1260 void
1262  LLVMBool Value) {
1264  Builder->DisableUnrollLoops = Value;
1265 }
1266 
1267 void
1269  LLVMBool Value) {
1270  // NOTE: The simplify-libcalls pass has been removed.
1271 }
1272 
1273 void
1275  unsigned Threshold) {
1278 }
1279 
1280 void
1282  LLVMPassManagerRef PM) {
1284  legacy::FunctionPassManager *FPM = unwrap<legacy::FunctionPassManager>(PM);
1285  Builder->populateFunctionPassManager(*FPM);
1286 }
1287 
1288 void
1290  LLVMPassManagerRef PM) {
1293  Builder->populateModulePassManager(*MPM);
1294 }
1295 
1297  LLVMPassManagerRef PM,
1298  LLVMBool Internalize,
1299  LLVMBool RunInliner) {
1301  legacy::PassManagerBase *LPM = unwrap(PM);
1302 
1303  // A small backwards compatibility hack. populateLTOPassManager used to take
1304  // an RunInliner option.
1305  if (RunInliner && !Builder->Inliner)
1306  Builder->Inliner = createFunctionInliningPass();
1307 
1308  Builder->populateLTOPassManager(*LPM);
1309 }
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:174
i
i
Definition: README.txt:29
llvm::createLoopLoadEliminationPass
FunctionPass * createLoopLoadEliminationPass()
Definition: LoopLoadElimination.cpp:705
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:606
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:3096
llvm::RunNewGVN
cl::opt< bool > RunNewGVN
llvm::createGVNSinkPass
FunctionPass * createGVNSinkPass()
Definition: GVNSink.cpp:930
llvm::PassManagerBuilder::PGOSampleUse
std::string PGOSampleUse
Path of the sample Profile data file.
Definition: PassManagerBuilder.h:188
LLVMPassManagerBuilderPopulateFunctionPassManager
void LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)
See llvm::PassManagerBuilder::populateFunctionPassManager.
Definition: PassManagerBuilder.cpp:1281
llvm
Definition: AllocatorList.h:23
llvm::createTailCallEliminationPass
FunctionPass * createTailCallEliminationPass()
Definition: TailRecursionElimination.cpp:878
llvm::createCrossDSOCFIPass
ModulePass * createCrossDSOCFIPass()
This pass export CFI checks for use by external modules.
llvm::PassManagerBuilder::PassManagerBuilder
PassManagerBuilder()
Definition: PassManagerBuilder.cpp:184
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:168
llvm::ExtraVectorizerPasses
cl::opt< bool > ExtraVectorizerPasses
llvm::EnableConstraintElimination
cl::opt< bool > EnableConstraintElimination
llvm::ALL
@ ALL
Definition: Attributor.h:3847
llvm::createCFGSimplificationPass
FunctionPass * createCFGSimplificationPass(SimplifyCFGOptions Options=SimplifyCFGOptions(), std::function< bool(const Function &)> Ftor=nullptr)
Definition: SimplifyCFGPass.cpp:388
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:771
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:1189
llvm::RunPartialInlining
cl::opt< bool > RunPartialInlining
ManagedStatic.h
llvm::PassManagerBuilder::LoopVectorize
bool LoopVectorize
Definition: PassManagerBuilder.h:161
CGPassBuilderOption.h
llvm::createPGOInstrumentationUseLegacyPass
ModulePass * createPGOInstrumentationUseLegacyPass(StringRef Filename=StringRef(""), bool IsCS=false)
Definition: PGOInstrumentation.cpp:497
GlobalsModRef.h
llvm::createEarlyCSEPass
FunctionPass * createEarlyCSEPass(bool UseMemorySSA=false)
Definition: EarlyCSE.cpp:1699
VectorCombine.h
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::createSampleProfileLoaderPass
ModulePass * createSampleProfileLoaderPass()
Definition: SampleProfile.cpp:1803
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:165
LLVMPassManagerBuilderSetDisableSimplifyLibCalls
void LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableSimplifyLibCalls.
Definition: PassManagerBuilder.cpp:1268
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:906
llvm::createCFLSteensAAWrapperPass
ImmutablePass * createCFLSteensAAWrapperPass()
llvm::createLoopIdiomPass
Pass * createLoopIdiomPass()
Definition: LoopIdiomRecognize.cpp:345
llvm::PassManagerBuilder::PerformThinLTO
bool PerformThinLTO
Definition: PassManagerBuilder.h:172
llvm::CFLAAType::Andersen
@ Andersen
llvm::createDeadStoreEliminationPass
FunctionPass * createDeadStoreEliminationPass()
Definition: DeadStoreElimination.cpp:2100
llvm::PassManagerBuilder::ExtensionPointTy
ExtensionPointTy
Definition: PassManagerBuilder.h:68
llvm::PassManagerBuilder::ForgetAllSCEVInLoopUnroll
bool ForgetAllSCEVInLoopUnroll
Definition: PassManagerBuilder.h:166
LLVMPassManagerBuilderDispose
void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB)
Definition: PassManagerBuilder.cpp:1235
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:97
llvm::InlineParams
Thresholds to tune inline cost analysis.
Definition: InlineCost.h:160
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:301
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:3059
llvm::EnableMatrix
cl::opt< bool > EnableMatrix
llvm::createAttributorLegacyPass
Pass * createAttributorLegacyPass()
Definition: Attributor.cpp:2596
STLExtras.h
llvm::createCGProfileLegacyPass
ModulePass * createCGProfileLegacyPass()
llvm::createCallSiteSplittingPass
FunctionPass * createCallSiteSplittingPass()
Definition: CallSiteSplitting.cpp:575
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:140
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:2597
llvm::createFloat2IntPass
FunctionPass * createFloat2IntPass()
Definition: Float2Int.cpp:538
llvm::createDivRemPairsPass
FunctionPass * createDivRemPairsPass()
Definition: DivRemPairs.cpp:384
llvm::createSLPVectorizerPass
Pass * createSLPVectorizerPass()
Definition: SLPVectorizer.cpp:8166
CommandLine.h
llvm::PassManagerBuilder::PGOInstrGen
std::string PGOInstrGen
Profile data file name that the instrumentation will be written to.
Definition: PassManagerBuilder.h:184
llvm::MODULE
@ MODULE
Definition: Attributor.h:3845
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:226
llvm::createLoopUnswitchPass
Pass * createLoopUnswitchPass(bool OptimizeForSize=false, bool hasBranchDivergence=false)
Definition: LoopUnswitch.cpp:412
LLVMPassManagerBuilderPopulateLTOPassManager
void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM, LLVMBool Internalize, LLVMBool RunInliner)
See llvm::PassManagerBuilder::populateLTOPassManager.
Definition: PassManagerBuilder.cpp:1296
llvm::createForceFunctionAttrsLegacyPass
Pass * createForceFunctionAttrsLegacyPass()
Create a legacy pass manager instance of a pass to force function attrs.
llvm::FlattenedProfileUsed
cl::opt< bool > FlattenedProfileUsed
llvm::PassManagerBuilder::NewGVN
bool NewGVN
Definition: PassManagerBuilder.h:164
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:237
llvm::createLoopInterchangePass
Pass * createLoopInterchangePass()
Definition: LoopInterchange.cpp:1760
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:748
llvm::createLowerMatrixIntrinsicsPass
Pass * createLowerMatrixIntrinsicsPass()
Definition: LowerMatrixIntrinsics.cpp:2046
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:227
llvm::DisablePreInliner
cl::opt< bool > DisablePreInliner
llvm::createLibCallsShrinkWrapPass
FunctionPass * createLibCallsShrinkWrapPass()
Definition: LibCallsShrinkWrap.cpp:547
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:244
Options
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Definition: PassBuilderBindings.cpp:48
llvm::PassManagerBuilder::PrepareForThinLTO
bool PrepareForThinLTO
Definition: PassManagerBuilder.h:171
llvm::PassManagerBuilder::Inliner
Pass * Inliner
Inliner - Specifies the inliner to use.
Definition: PassManagerBuilder.h:145
llvm::PassManagerBuilder::MergeFunctions
bool MergeFunctions
Definition: PassManagerBuilder.h:169
llvm::createIndVarSimplifyPass
Pass * createIndVarSimplifyPass()
Definition: IndVarSimplify.cpp:1986
GVN.h
llvm::createAnnotationRemarksLegacyPass
FunctionPass * createAnnotationRemarksLegacyPass()
Definition: AnnotationRemarks.cpp:152
llvm::createGlobalOptimizerPass
ModulePass * createGlobalOptimizerPass()
createGlobalOptimizerPass - This function returns a new pass that optimizes non-address taken interna...
Definition: GlobalOpt.cpp:2687
llvm::createLoopDistributePass
FunctionPass * createLoopDistributePass()
llvm::createPGOMemOPSizeOptLegacyPass
FunctionPass * createPGOMemOPSizeOptLegacyPass()
llvm::PreInlineThreshold
cl::opt< int > PreInlineThreshold
llvm::PassManagerBuilder::LicmMssaNoAccForPromotionCap
unsigned LicmMssaNoAccForPromotionCap
Definition: PassManagerBuilder.h:175
CFLAndersAliasAnalysis.h
Utils.h
ScopedNoAliasAA.h
llvm::PassManagerBuilder::LoopsInterleaved
bool LoopsInterleaved
Definition: PassManagerBuilder.h:162
llvm::createHotColdSplittingPass
ModulePass * createHotColdSplittingPass()
createHotColdSplittingPass - This pass outlines cold blocks into a separate function(s).
Definition: HotColdSplitting.cpp:792
InstSimplifyPass.h
llvm::createSimpleLoopUnrollPass
Pass * createSimpleLoopUnrollPass(int OptLevel=2, bool OnlyWhenForced=false, bool ForgetAllSCEV=false)
Definition: LoopUnrollPass.cpp:1319
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:1274
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:105
llvm::PassManagerBuilder::~PassManagerBuilder
~PassManagerBuilder()
Definition: PassManagerBuilder.cpp:215
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:1262
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:447
llvm::createReversePostOrderFunctionAttrsPass
Pass * createReversePostOrderFunctionAttrsPass()
createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call graph in RPO to deduce and...
Definition: FunctionAttrs.cpp:1734
llvm::createAggressiveInstCombinerPass
FunctionPass * createAggressiveInstCombinerPass()
Definition: AggressiveInstCombine.cpp:457
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:163
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:125
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:1682
llvm::createPGOInstrumentationGenLegacyPass
ModulePass * createPGOInstrumentationGenLegacyPass(bool IsCS=false)
Definition: PGOInstrumentation.cpp:483
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:186
llvm::PassManagerBuilder::GlobalExtensionID
int GlobalExtensionID
Definition: PassManagerBuilder.h:66
InlineCost.h
llvm::PassManagerBuilder::VerifyInput
bool VerifyInput
Definition: PassManagerBuilder.h:167
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:1116
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::createSCCPPass
FunctionPass * createSCCPPass()
Definition: SCCP.cpp:295
LLVMPassManagerRef
struct LLVMOpaquePassManager * LLVMPassManagerRef
Definition: Types.h:127
llvm::CFLAAType::Steensgaard
@ Steensgaard
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:239
llvm::PassManagerBuilder::CallGraphProfile
bool CallGraphProfile
Definition: PassManagerBuilder.h:159
llvm::CGSCC
@ CGSCC
Definition: Attributor.h:3846
llvm::PassManagerBuilder::SLPVectorize
bool SLPVectorize
Definition: PassManagerBuilder.h:160
DataLayout.h
llvm::createIROutlinerPass
ModulePass * createIROutlinerPass()
createIROutlinerPass - This pass finds similar code regions and factors those regions out into functi...
Definition: IROutliner.cpp:1761
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:6174
llvm::createReassociatePass
FunctionPass * createReassociatePass()
llvm::PassManagerBuilder::PrepareForLTO
bool PrepareForLTO
Definition: PassManagerBuilder.h:170
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:1509
LLVMPassManagerBuilderSetOptLevel
void LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, unsigned OptLevel)
See llvm::PassManagerBuilder::OptLevel.
Definition: PassManagerBuilder.cpp:1241
llvm::ForgetSCEVInLoopUnroll
cl::opt< bool > ForgetSCEVInLoopUnroll
SLPVectorizer.h
Verifier.h
llvm::createAggressiveDCEPass
FunctionPass * createAggressiveDCEPass()
Definition: ADCE.cpp:751
llvm::PassManagerBuilder::removeGlobalExtension
static void removeGlobalExtension(GlobalExtensionID ExtensionID)
Removes an extension that was previously added using addGlobalExtension.
Definition: PassManagerBuilder.cpp:244
LLVMPassManagerBuilderSetSizeLevel
void LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, unsigned SizeLevel)
See llvm::PassManagerBuilder::SizeLevel.
Definition: PassManagerBuilder.cpp:1248
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:178
llvm::createScopedNoAliasAAWrapperPass
ImmutablePass * createScopedNoAliasAAWrapperPass()
llvm::createBitTrackingDCEPass
FunctionPass * createBitTrackingDCEPass()
Definition: BDCE.cpp:206
llvm::createAlignmentFromAssumptionsPass
FunctionPass * createAlignmentFromAssumptionsPass()
Definition: AlignmentFromAssumptions.cpp:85
LLVMPassManagerBuilderSetDisableUnitAtATime
void LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableUnitAtATime.
Definition: PassManagerBuilder.cpp:1255
llvm::PassManagerBuilder::populateModulePassManager
void populateModulePassManager(legacy::PassManagerBase &MPM)
populateModulePassManager - This sets up the primary pass manager.
Definition: PassManagerBuilder.cpp:644
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:156
LLVMPassManagerBuilderSetDisableUnrollLoops
void LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, LLVMBool Value)
See llvm::PassManagerBuilder::DisableUnrollLoops.
Definition: PassManagerBuilder.cpp:1261
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:255
llvm::PassManagerBuilder::EnablePGOCSInstrGen
bool EnablePGOCSInstrGen
Enable profile context sensitive instrumentation pass.
Definition: PassManagerBuilder.h:180
LLVMPassManagerBuilderCreate
LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate()
See llvm::PassManagerBuilder.
Definition: PassManagerBuilder.cpp:1230
llvm::createPromoteMemoryToRegisterPass
FunctionPass * createPromoteMemoryToRegisterPass()
Definition: Mem2Reg.cpp:114
llvm::PassManagerBuilder::EnablePGOCSInstrUse
bool EnablePGOCSInstrUse
Enable profile context sensitive profile use pass.
Definition: PassManagerBuilder.h:182
llvm::createInstructionCombiningPass
FunctionPass * createInstructionCombiningPass()
Definition: InstructionCombining.cpp:4131
LLVMPassManagerBuilderPopulateModulePassManager
void LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, LLVMPassManagerRef PM)
See llvm::PassManagerBuilder::populateModulePassManager.
Definition: PassManagerBuilder.cpp:1289
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:302
llvm::SimplifyCFGOptions
Definition: SimplifyCFGOptions.h:23
llvm::createLICMPass
Pass * createLICMPass()
Definition: LICM.cpp:310
llvm::PassManagerBuilder::DisableUnrollLoops
bool DisableUnrollLoops
Definition: PassManagerBuilder.h:158
llvm::createConstraintEliminationPass
FunctionPass * createConstraintEliminationPass()
Definition: ConstraintElimination.cpp:517
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:3844
llvm::createLowerConstantIntrinsicsPass
FunctionPass * createLowerConstantIntrinsicsPass()
Definition: LowerConstantIntrinsics.cpp:198
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:733
llvm::createInstrOrderFilePass
ModulePass * createInstrOrderFilePass()
Definition: InstrOrderFile.cpp:210
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:261
llvm::PassManagerBuilder::populateThinLTOPassManager
void populateThinLTOPassManager(legacy::PassManagerBase &PM)
Definition: PassManagerBuilder.cpp:1156
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:2088
llvm::PassManagerBuilder::DivergentTarget
bool DivergentTarget
Definition: PassManagerBuilder.h:173
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::SetLicmMssaOptCap
cl::opt< unsigned > SetLicmMssaOptCap
llvm::createLoopDeletionPass
Pass * createLoopDeletionPass()
Definition: LoopDeletion.cpp:313
llvm::createSROAPass
FunctionPass * createSROAPass()
Definition: SROA.cpp:4829
MPM
ModulePassManager MPM
Definition: PassBuilderBindings.cpp:70
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
FunctionAttrs.h
CFLSteensAliasAnalysis.h
llvm::createLoopUnrollAndJamPass
Pass * createLoopUnrollAndJamPass(int OptLevel=2)
Definition: LoopUnrollAndJamPass.cpp:517
llvm::createJumpThreadingPass
FunctionPass * createJumpThreadingPass(bool FreezeSelectCond=false, int Threshold=-1)
Definition: JumpThreading.cpp:178
llvm::createLoopVectorizePass
Pass * createLoopVectorizePass()
Definition: LoopVectorize.cpp:7797
GlobalExtensionsNotEmpty
static bool GlobalExtensionsNotEmpty()
Check if GlobalExtensions is constructed and not empty.
Definition: PassManagerBuilder.cpp:232
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:1302
llvm::createAnnotation2MetadataLegacyPass
ModulePass * createAnnotation2MetadataLegacyPass()
Definition: Annotation2Metadata.cpp:98
llvm::createOpenMPOptCGSCCLegacyPass
Pass * createOpenMPOptCGSCCLegacyPass()
createOpenMPOptLegacyPass - OpenMP specific optimizations.
Definition: OpenMPOpt.cpp:2701
Passes.h
llvm::EnableGVNHoist
cl::opt< bool > EnableGVNHoist