llvm.org GIT mirror llvm / 3197b44
Add an option to turn off the expensive GVN load PRE part of GVN. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153902 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
3 changed file(s) with 13 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
130130 /// populateModulePassManager - This sets up the primary pass manager.
131131 void populateModulePassManager(PassManagerBase &MPM);
132132 void populateLTOPassManager(PassManagerBase &PM, bool Internalize,
133 bool RunInliner);
133 bool RunInliner, bool DisableGVNLoadPRE = false);
134134 };
135
135136 /// Registers a function for adding a standard set of passes. This should be
136137 /// used by optimizer plugins to allow all front ends to transparently use
137138 /// them. Create a static instance of this class in your plugin, providing a
142143 PassManagerBuilder::addGlobalExtension(Ty, Fn);
143144 }
144145 };
146
145147 } // end namespace llvm
146148 #endif
206206
207207 void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
208208 bool Internalize,
209 bool RunInliner) {
209 bool RunInliner,
210 bool DisableGVNLoadPRE) {
210211 // Provide AliasAnalysis services for optimizations.
211212 addInitialAliasAnalysisPasses(PM);
212213
262263 PM.add(createFunctionAttrsPass()); // Add nocapture.
263264 PM.add(createGlobalsModRefPass()); // IP alias analysis.
264265
265 PM.add(createLICMPass()); // Hoist loop invariants.
266 PM.add(createGVNPass()); // Remove redundancies.
267 PM.add(createMemCpyOptPass()); // Remove dead memcpys.
266 PM.add(createLICMPass()); // Hoist loop invariants.
267 PM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies.
268 PM.add(createMemCpyOptPass()); // Remove dead memcpys.
268269 // Nuke dead stores.
269270 PM.add(createDeadStoreEliminationPass());
270271
4848 static cl::opt DisableInline("disable-inlining",
4949 cl::desc("Do not run the inliner pass"));
5050
51 static cl::opt DisableGVNLoadPRE("disable-gvn-loadpre",
52 cl::desc("Do not run the GVN load PRE pass"));
53
5154 const char* LTOCodeGenerator::getVersionString() {
5255 #ifdef LLVM_VERSION_INFO
5356 return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
352355 passes.add(new TargetData(*_target->getTargetData()));
353356
354357 PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/ false,
355 !DisableInline);
358 !DisableInline,
359 DisableGVNLoadPRE);
356360
357361 // Make sure everything is still good.
358362 passes.add(createVerifierPass());