summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-05-27 16:14:35 +0000
committerDehao Chen <dehao@google.com>2016-05-27 16:14:35 +0000
commited8c1beefbe7b67bcfcecfbb1ea33a196f3f6861 (patch)
treee297af79f01c0a6145ff3d6eca2de2b542b7f6d0 /clang/lib/CodeGen/BackendUtil.cpp
parent80b16d413548ddefe8dfa5135345a93c249f634b (diff)
downloadbcm5719-llvm-ed8c1beefbe7b67bcfcecfbb1ea33a196f3f6861.tar.gz
bcm5719-llvm-ed8c1beefbe7b67bcfcecfbb1ea33a196f3f6861.zip
Add instcombine pass if sampleprofile pass is enabled.
Summary: 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. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20502 llvm-svn: 271010
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 5b9f77cc49c..2577eecdf84 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -178,6 +178,11 @@ static void addAddDiscriminatorsPass(const PassManagerBuilder &Builder,
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());
@@ -441,7 +446,6 @@ void EmitAssemblyHelper::CreatePasses(ModuleSummaryIndex *ModuleSummary) {
legacy::FunctionPassManager *FPM = getPerFunctionPasses();
if (CodeGenOpts.VerifyModule)
FPM->add(createVerifierPass());
- PMBuilder.populateFunctionPassManager(*FPM);
// Set up the per-module pass manager.
if (!CodeGenOpts.RewriteMapFiles.empty())
@@ -480,9 +484,13 @@ void EmitAssemblyHelper::CreatePasses(ModuleSummaryIndex *ModuleSummary) {
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);
}
OpenPOWER on IntegriCloud