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