Invoke PruneEH pass before Sample Profile pass.

Summary: We need to call PruneEH pass before AutoFDO pass so that some EH-related calls can get inlined in Sample Profile pass.

Reviewers: davidxl, dnovillo

Subscribers: junbuml, llvm-commits

Differential Revision: http://reviews.llvm.org/D21197

llvm-svn: 273298
This commit is contained in:
Dehao Chen 2016-06-21 19:16:41 +00:00
parent c76f9f0df8
commit 1997d8684f
3 changed files with 9 additions and 0 deletions

View File

@ -488,6 +488,7 @@ void EmitAssemblyHelper::CreatePasses(ModuleSummaryIndex *ModuleSummary) {
PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
if (!CodeGenOpts.SampleProfileFile.empty()) {
MPM->add(createPruneEHPass());
MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
addInstructionCombiningPass);

View File

@ -0,0 +1,2 @@
bar:100:100
1: 2000

View File

@ -0,0 +1,6 @@
// Test if PGO sample use passes are invoked.
//
// Ensure Pass PGOInstrumentationGenPass is invoked.
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s
// CHECK: Remove unused exception handling info
// CHECK: Sample profile pass