summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h4
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp8
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp12
-rw-r--r--llvm/tools/bugpoint/bugpoint.cpp2
-rw-r--r--llvm/tools/opt/opt.cpp2
5 files changed, 15 insertions, 13 deletions
diff --git a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
index 15ad26b1976..7c54ad6f64a 100644
--- a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
+++ b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h
@@ -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
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 231e4838470..2a195400e3b 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -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());
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index e7655774c92..301279fdc8f 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -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);
}
diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp
index cbecc359970..8a0d7aa4afb 100644
--- a/llvm/tools/bugpoint/bugpoint.cpp
+++ b/llvm/tools/bugpoint/bugpoint.cpp
@@ -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) {
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 1ff795d67d2..538c18cc488 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -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);
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud