[llvm] r217731 - Add control of function merging to the PMBuilder.
Nick Lewycky
nicholas at mxc.ca
Sat Sep 13 14:46:00 PDT 2014
Author: nicholas
Date: Sat Sep 13 16:46:00 2014
New Revision: 217731
URL: http://llvm.org/viewvc/llvm-project?rev=217731&view=rev
Log:
Add control of function merging to the PMBuilder.
Modified:
llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h
llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
Modified: llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h?rev=217731&r1=217730&r2=217731&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/PassManagerBuilder.h Sat Sep 13 16:46:00 2014
@@ -123,6 +123,7 @@ public:
bool VerifyInput;
bool VerifyOutput;
bool StripDebug;
+ bool MergeFunctions;
private:
/// ExtensionList - This is list of all of the extensions that are registered.
Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=217731&r1=217730&r2=217731&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Sat Sep 13 16:46:00 2014
@@ -91,6 +91,7 @@ PassManagerBuilder::PassManagerBuilder()
VerifyInput = false;
VerifyOutput = false;
StripDebug = false;
+ MergeFunctions = false;
}
PassManagerBuilder::~PassManagerBuilder() {
@@ -330,6 +331,10 @@ void PassManagerBuilder::populateModuleP
MPM.add(createConstantMergePass()); // Merge dup global constants
}
}
+
+ if (MergeFunctions)
+ MPM.add(createMergeFunctionsPass());
+
addExtensionsToPM(EP_OptimizerLast, MPM);
}
@@ -427,6 +432,11 @@ void PassManagerBuilder::addLTOOptimizat
// Now that we have optimized the program, discard unreachable functions.
PM.add(createGlobalDCEPass());
+
+ // FIXME: this is profitable (for compiler time) to do at -O0 too, but
+ // currently it damages debug info.
+ if (MergeFunctions)
+ PM.add(createMergeFunctionsPass());
}
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
More information about the llvm-commits
mailing list