bool LoopVectorize;
bool RerollLoops;
bool LoadCombine;
+ bool DisableGVNLoadPRE;
private:
/// ExtensionList - This is list of all of the extensions that are registered.
/// 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
// 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());
LoopVectorize = RunLoopVectorization;
RerollLoops = RunLoopRerolling;
LoadCombine = RunLoadCombine;
+ DisableGVNLoadPRE = false;
}
PassManagerBuilder::~PassManagerBuilder() {
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
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
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
}
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
- bool RunInliner,
- bool DisableGVNLoadPRE) {
+ bool RunInliner) {
// Provide AliasAnalysis services for optimizations.
addInitialAliasAnalysisPasses(PM);
LLVMBool RunInliner) {
PassManagerBuilder *Builder = unwrap(PMB);
PassManagerBase *LPM = unwrap(PM);
- Builder->populateLTOPassManager(*LPM, RunInliner != 0, false);
+ Builder->populateLTOPassManager(*LPM, RunInliner != 0);
}
if (DisableOptimizations) return;
PassManagerBuilder Builder;
- Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline, false);
+ Builder.populateLTOPassManager(PM, /*RunInliner=*/!DisableInline);
}
//===----------------------------------------------------------------------===//