llvm.org GIT mirror llvm / 0b994a7
Handle inlining in populateLTOPassManager like in populateModulePassManager. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216178 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
5 changed file(s) with 23 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
144144
145145 /// populateModulePassManager - This sets up the primary pass manager.
146146 void populateModulePassManager(PassManagerBase &MPM);
147 void populateLTOPassManager(PassManagerBase &PM, bool RunInliner);
147 void populateLTOPassManager(PassManagerBase &PM);
148148 };
149149
150150 /// Registers a function for adding a standard set of passes. This should be
476476 if (!DisableOpt) {
477477 PassManagerBuilder PMB;
478478 PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
479 PMB.populateLTOPassManager(passes, !DisableInline);
479 if (!DisableInline)
480 PMB.Inliner = createFunctionInliningPass();
481 PMB.populateLTOPassManager(passes);
480482 }
481483
482484 // Make sure everything is still good.
312312 addExtensionsToPM(EP_OptimizerLast, MPM);
313313 }
314314
315 void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
316 bool RunInliner) {
315 void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM) {
317316 // Provide AliasAnalysis services for optimizations.
318317 addInitialAliasAnalysisPasses(PM);
319318
340339 addExtensionsToPM(EP_Peephole, PM);
341340
342341 // Inline small functions
343 if (RunInliner)
344 PM.add(createFunctionInliningPass());
342 bool RunInliner = Inliner;
343 if (RunInliner) {
344 PM.add(Inliner);
345 Inliner = nullptr;
346 }
345347
346348 PM.add(createPruneEHPass()); // Remove dead EH info.
347349
482484 LLVMBool RunInliner) {
483485 PassManagerBuilder *Builder = unwrap(PMB);
484486 PassManagerBase *LPM = unwrap(PM);
485 Builder->populateLTOPassManager(*LPM, RunInliner != 0);
486 }
487
488 // A small backwards compatibility hack. populateLTOPassManager used to take
489 // an RunInliner option.
490 if (RunInliner && !Builder->Inliner)
491 Builder->Inliner = createFunctionInliningPass();
492
493 Builder->populateLTOPassManager(*LPM);
494 }
178178
179179 if (StandardLinkOpts) {
180180 PassManagerBuilder Builder;
181 Builder.populateLTOPassManager(PM, /*RunInliner=*/true);
181 Builder.Inliner = createFunctionInliningPass();
182 Builder.populateLTOPassManager(PM);
182183 }
183184
184185 if (OptLevelO1 || OptLevelO2 || OptLevelO3) {
266266 if (DisableOptimizations) return;
267267
268268 PassManagerBuilder Builder;
269 Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline);
269 if (!DisableInline)
270 Builder.Inliner = createFunctionInliningPass();
271 Builder.populateLTOPassManager(PM);
270272 }
271273
272274 //===----------------------------------------------------------------------===//