Move DisableGVNLoadPRE from populateLTOPassManager to PassManagerBuilder.

llvm-svn: 216174
This commit is contained in:
Rafael Espindola 2014-08-21 13:13:17 +00:00
parent 7806ab827f
commit f79b5bf8bb
5 changed files with 15 additions and 13 deletions

View File

@ -118,6 +118,7 @@ public:
bool LoopVectorize;
bool RerollLoops;
bool LoadCombine;
bool DisableGVNLoadPRE;
private:
/// ExtensionList - This is list of all of the extensions that are registered.
@ -144,8 +145,7 @@ public:
/// populateModulePassManager - This sets up the primary pass manager.
void populateModulePassManager(PassManagerBase &MPM);
void populateLTOPassManager(PassManagerBase &PM, bool RunInliner,
bool DisableGVNLoadPRE);
void populateLTOPassManager(PassManagerBase &PM, bool RunInliner);
};
/// Registers a function for adding a standard set of passes. This should be

View File

@ -474,9 +474,11 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
// Enabling internalize here would use its AllButMain variant. It
// keeps only main if it exists and does nothing for libraries. Instead
// we create the pass ourselves with the symbol list provided by the linker.
if (!DisableOpt)
PassManagerBuilder().populateLTOPassManager(passes, !DisableInline,
DisableGVNLoadPRE);
if (!DisableOpt) {
PassManagerBuilder PMB;
PMB.DisableGVNLoadPRE = DisableGVNLoadPRE;
PMB.populateLTOPassManager(passes, !DisableInline);
}
// Make sure everything is still good.
passes.add(createVerifierPass());

View File

@ -77,6 +77,7 @@ PassManagerBuilder::PassManagerBuilder() {
LoopVectorize = RunLoopVectorization;
RerollLoops = RunLoopRerolling;
LoadCombine = RunLoadCombine;
DisableGVNLoadPRE = false;
}
PassManagerBuilder::~PassManagerBuilder() {
@ -217,7 +218,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
if (OptLevel > 1) {
MPM.add(createMergedLoadStoreMotionPass()); // Merge load/stores in diamond
MPM.add(createGVNPass()); // Remove redundancies
MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
}
MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset
MPM.add(createSCCPPass()); // Constant prop with SCCP
@ -243,7 +244,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
MPM.add(createInstructionCombiningPass());
addExtensionsToPM(EP_Peephole, MPM);
if (OptLevel > 1 && UseGVNAfterVectorization)
MPM.add(createGVNPass()); // Remove redundancies
MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
else
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
@ -282,7 +283,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
MPM.add(createInstructionCombiningPass());
addExtensionsToPM(EP_Peephole, MPM);
if (OptLevel > 1 && UseGVNAfterVectorization)
MPM.add(createGVNPass()); // Remove redundancies
MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies
else
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
@ -313,8 +314,7 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
}
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
bool RunInliner,
bool DisableGVNLoadPRE) {
bool RunInliner) {
// Provide AliasAnalysis services for optimizations.
addInitialAliasAnalysisPasses(PM);
@ -483,5 +483,5 @@ void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB,
LLVMBool RunInliner) {
PassManagerBuilder *Builder = unwrap(PMB);
PassManagerBase *LPM = unwrap(PM);
Builder->populateLTOPassManager(*LPM, RunInliner != 0, false);
Builder->populateLTOPassManager(*LPM, RunInliner != 0);
}

View File

@ -179,7 +179,7 @@ int main(int argc, char **argv) {
if (StandardLinkOpts) {
PassManagerBuilder Builder;
Builder.populateLTOPassManager(PM, /*RunInliner=*/true, false);
Builder.populateLTOPassManager(PM, /*RunInliner=*/true);
}
if (OptLevelO1 || OptLevelO2 || OptLevelO3) {

View File

@ -267,7 +267,7 @@ static void AddStandardLinkPasses(PassManagerBase &PM) {
if (DisableOptimizations) return;
PassManagerBuilder Builder;
Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline, false);
Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline);
}
//===----------------------------------------------------------------------===//