summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2016-03-02 20:59:36 +0000
committerRong Xu <xur@google.com>2016-03-02 20:59:36 +0000
commit9c6f1538cc0f70fe43d47cf818ad797c82b61d5f (patch)
treeb86604baa3284b38067401726b173344be8ceb75 /clang/test/CodeGen
parent783fb1f6426f32e5bb7731d57cd517a90fa7bccd (diff)
downloadbcm5719-llvm-9c6f1538cc0f70fe43d47cf818ad797c82b61d5f.tar.gz
bcm5719-llvm-9c6f1538cc0f70fe43d47cf818ad797c82b61d5f.zip
[PGO] Change profile use cc1 option to handle IR level profiles
This patch changes cc1 option for PGO profile use from -fprofile-instr-use=<path> to -fprofile-instrument-use-path=<path>. -fprofile-instr-use=<path> is now a driver only option. In addition to decouple the cc1 option from the driver level option, this patch also enables IR level profile use. cc1 option handling now reads the profile header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM} -- this is a common enum for -fprofile-instrument={}, for the profile instrumentation), and invoke the pipeline to enable the respective PGO use pass. Reviewers: silvas, davidxl Differential Revision: http://reviews.llvm.org/D17737 llvm-svn: 262515
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/Inputs/pgotestclang.profraw1
-rw-r--r--clang/test/CodeGen/Inputs/pgotestir.profraw1
-rw-r--r--clang/test/CodeGen/pgo-instrumentation.c11
3 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGen/Inputs/pgotestclang.profraw b/clang/test/CodeGen/Inputs/pgotestclang.profraw
new file mode 100644
index 00000000000..401ba073493
--- /dev/null
+++ b/clang/test/CodeGen/Inputs/pgotestclang.profraw
@@ -0,0 +1 @@
+:fe
diff --git a/clang/test/CodeGen/Inputs/pgotestir.profraw b/clang/test/CodeGen/Inputs/pgotestir.profraw
new file mode 100644
index 00000000000..04a7c1c1a35
--- /dev/null
+++ b/clang/test/CodeGen/Inputs/pgotestir.profraw
@@ -0,0 +1 @@
+:ir
diff --git a/clang/test/CodeGen/pgo-instrumentation.c b/clang/test/CodeGen/pgo-instrumentation.c
index f78ab20a129..1dac36fa589 100644
--- a/clang/test/CodeGen/pgo-instrumentation.c
+++ b/clang/test/CodeGen/pgo-instrumentation.c
@@ -7,3 +7,14 @@
// Ensure Pass PGOInstrumentationGenPass is not invoked.
// RUN: %clang_cc1 -O2 -fprofile-instrument=clang %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOGENPASS-INVOKED-INSTR-GEN-CLANG
// CHECK-PGOGENPASS-INVOKED-INSTR-GEN-CLANG-NOT: PGOInstrumentationGenPass
+
+// Ensure Pass PGOInstrumentationUsePass is invoked.
+// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgotestir.profraw
+// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t.profdata %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-INSTR-USE
+// CHECK-PGOUSEPASS-INVOKED-INSTR-USE: PGOInstrumentationUsePass
+//
+// Ensure Pass PGOInstrumentationUsePass is not invoked.
+// RUN: llvm-profdata merge -o %t.profdata %S/Inputs/pgotestclang.profraw
+// RUN: %clang_cc1 -O2 -fprofile-instrument-use-path=%t.profdata %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PGOUSEPASS-INVOKED-USE-CLANG
+// CHECK-PGOUSEPASS-INVOKED-USE-CLANG-NOT: PGOInstrumentationUsePass
+
OpenPOWER on IntegriCloud