[PATCH] D20502: Add instcombine pass if sampleprofile pass is enabled.
Dehao Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri May 20 17:25:37 PDT 2016
danielcdh created this revision.
danielcdh added a reviewer: davidxl.
danielcdh added a subscriber: llvm-commits.
Sample profile pass need to have instcombine pass. A related change is http://reviews.llvm.org/D17742. But we should not explicitly add dependency between to non-analysis passes. So we add the dependency here.
http://reviews.llvm.org/D20502
Files:
lib/CodeGen/BackendUtil.cpp
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -178,6 +178,11 @@
PM.add(createAddDiscriminatorsPass());
}
+static void addInstructionCombiningPass(const PassManagerBuilder &Builder,
+ legacy::PassManagerBase &PM) {
+ PM.add(createInstructionCombiningPass());
+}
+
static void addBoundsCheckingPass(const PassManagerBuilder &Builder,
legacy::PassManagerBase &PM) {
PM.add(createBoundsCheckingPass());
@@ -439,7 +444,6 @@
legacy::FunctionPassManager *FPM = getPerFunctionPasses();
if (CodeGenOpts.VerifyModule)
FPM->add(createVerifierPass());
- PMBuilder.populateFunctionPassManager(*FPM);
// Set up the per-module pass manager.
if (!CodeGenOpts.RewriteMapFiles.empty())
@@ -478,9 +482,13 @@
if (CodeGenOpts.hasProfileIRUse())
PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
- if (!CodeGenOpts.SampleProfileFile.empty())
+ if (!CodeGenOpts.SampleProfileFile.empty()) {
MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
+ PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
+ addInstructionCombiningPass);
+ }
+ PMBuilder.populateFunctionPassManager(*FPM);
PMBuilder.populateModulePassManager(*MPM);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20502.58021.patch
Type: text/x-patch
Size: 1432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160521/dd6ad918/attachment.bin>
More information about the llvm-commits
mailing list