r273298 - Invoke PruneEH pass before Sample Profile pass.

Dehao Chen via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 12:16:42 PDT 2016


Author: dehao
Date: Tue Jun 21 14:16:41 2016
New Revision: 273298

URL: http://llvm.org/viewvc/llvm-project?rev=273298&view=rev
Log:
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

Added:
    cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof
    cfe/trunk/test/CodeGen/pgo-sample.c
Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=273298&r1=273297&r2=273298&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Jun 21 14:16:41 2016
@@ -488,6 +488,7 @@ void EmitAssemblyHelper::CreatePasses(Mo
     PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
 
   if (!CodeGenOpts.SampleProfileFile.empty()) {
+    MPM->add(createPruneEHPass());
     MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
     PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
                            addInstructionCombiningPass);

Added: cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof?rev=273298&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof (added)
+++ cfe/trunk/test/CodeGen/Inputs/pgo-sample.prof Tue Jun 21 14:16:41 2016
@@ -0,0 +1,2 @@
+bar:100:100
+ 1: 2000

Added: cfe/trunk/test/CodeGen/pgo-sample.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample.c?rev=273298&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/pgo-sample.c (added)
+++ cfe/trunk/test/CodeGen/pgo-sample.c Tue Jun 21 14:16:41 2016
@@ -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




More information about the cfe-commits mailing list