llvm.org GIT mirror llvm / 47199c3
Move DisableGVNLoadPRE from populateLTOPassManager to PassManagerBuilder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216174 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
5 changed file(s) with 16 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
117117 bool LoopVectorize;
118118 bool RerollLoops;
119119 bool LoadCombine;
120 bool DisableGVNLoadPRE;
120121
121122 private:
122123 /// ExtensionList - This is list of all of the extensions that are registered.
143144
144145 /// populateModulePassManager - This sets up the primary pass manager.
145146 void populateModulePassManager(PassManagerBase &MPM);
146 void populateLTOPassManager(PassManagerBase &PM, bool RunInliner,
147 bool DisableGVNLoadPRE);
147 void populateLTOPassManager(PassManagerBase &PM, bool RunInliner);
148148 };
149149
150150 /// Registers a function for adding a standard set of passes. This should be
473473 // Enabling internalize here would use its AllButMain variant. It
474474 // keeps only main if it exists and does nothing for libraries. Instead
475475 // we create the pass ourselves with the symbol list provided by the linker.
476 if (!DisableOpt)
477 PassManagerBuilder().populateLTOPassManager(passes, !DisableInline,
478 DisableGVNLoadPRE);
476 if (!DisableOpt) {
477 PassManagerBuilder PMB;
478 PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
479 PMB.populateLTOPassManager(passes, !DisableInline);
480 }
479481
480482 // Make sure everything is still good.
481483 passes.add(createVerifierPass());
7676 LoopVectorize = RunLoopVectorization;
7777 RerollLoops = RunLoopRerolling;
7878 LoadCombine = RunLoadCombine;
79 DisableGVNLoadPRE = false;
7980 }
8081
8182 PassManagerBuilder::~PassManagerBuilder() {
216217
217218 if (OptLevel > 1) {
218219 MPM.add(createMergedLoadStoreMotionPass()); // Merge load/stores in diamond
219 MPM.add(createGVNPass()); // Remove redundancies
220 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
220221 }
221222 MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset
222223 MPM.add(createSCCPPass()); // Constant prop with SCCP
242243 MPM.add(createInstructionCombiningPass());
243244 addExtensionsToPM(EP_Peephole, MPM);
244245 if (OptLevel > 1 && UseGVNAfterVectorization)
245 MPM.add(createGVNPass()); // Remove redundancies
246 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
246247 else
247248 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
248249
281282 MPM.add(createInstructionCombiningPass());
282283 addExtensionsToPM(EP_Peephole, MPM);
283284 if (OptLevel > 1 && UseGVNAfterVectorization)
284 MPM.add(createGVNPass()); // Remove redundancies
285 MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
285286 else
286287 MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
287288
312313 }
313314
314315 void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
315 bool RunInliner,
316 bool DisableGVNLoadPRE) {
316 bool RunInliner) {
317317 // Provide AliasAnalysis services for optimizations.
318318 addInitialAliasAnalysisPasses(PM);
319319
482482 LLVMBool RunInliner) {
483483 PassManagerBuilder *Builder = unwrap(PMB);
484484 PassManagerBase *LPM = unwrap(PM);
485 Builder->populateLTOPassManager(*LPM, RunInliner != 0, false);
486 }
485 Builder->populateLTOPassManager(*LPM, RunInliner != 0);
486 }
178178
179179 if (StandardLinkOpts) {
180180 PassManagerBuilder Builder;
181 Builder.populateLTOPassManager(PM, /*RunInliner=*/true, false);
181 Builder.populateLTOPassManager(PM, /*RunInliner=*/true);
182182 }
183183
184184 if (OptLevelO1 || OptLevelO2 || OptLevelO3) {
266266 if (DisableOptimizations) return;
267267
268268 PassManagerBuilder Builder;
269 Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline, false);
269 Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline);
270270 }
271271
272272 //===----------------------------------------------------------------------===//