[PATCH] D21197: Invoke PruneEH pass before Sample Profile pass.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 10:28:05 PDT 2016


danielcdh updated this revision to Diff 61403.
danielcdh added a comment.

add test


http://reviews.llvm.org/D21197

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/Inputs/pgo-sample.prof
  test/CodeGen/pgo-sample.c

Index: test/CodeGen/pgo-sample.c
===================================================================
--- /dev/null
+++ test/CodeGen/pgo-sample.c
@@ -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
Index: test/CodeGen/Inputs/pgo-sample.prof
===================================================================
--- /dev/null
+++ test/CodeGen/Inputs/pgo-sample.prof
@@ -0,0 +1,2 @@
+bar:100:100
+ 1: 2000
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -488,6 +488,7 @@
     PMBuilder.PGOInstrUse = CodeGenOpts.ProfileInstrumentUsePath;
 
   if (!CodeGenOpts.SampleProfileFile.empty()) {
+    MPM->add(createPruneEHPass());
     MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile));
     PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
                            addInstructionCombiningPass);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21197.61403.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160621/743012a5/attachment.bin>


More information about the llvm-commits mailing list