summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-06-14 21:38:57 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2019-06-14 21:38:57 +0000
commit5501dda2479580ae84291d0237e794feeb38a8d9 (patch)
treee8bc59fa19fcb92d12285b321abdb23645b9c033
parent282dac717eb440dd44d31fe8c3750650bd4d2cff (diff)
downloadbcm5719-llvm-5501dda2479580ae84291d0237e794feeb38a8d9.tar.gz
bcm5719-llvm-5501dda2479580ae84291d0237e794feeb38a8d9.zip
[Remarks][NFC] Improve testing and documentation of -foptimization-record-passes
This adds: * documentation to the user manual * nicer error message * test for the error case * test for the gold plugin llvm-svn: 363463
-rw-r--r--clang/docs/UsersManual.rst12
-rw-r--r--clang/include/clang/Basic/DiagnosticDriverKinds.td2
-rw-r--r--clang/test/CodeGen/opt-record.c3
-rw-r--r--llvm/test/tools/gold/X86/opt-remarks.ll2
4 files changed, 18 insertions, 1 deletions
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 39d9d966b24..54ff02cce1d 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -345,6 +345,18 @@ output format of the diagnostics that it generates.
after the primary file being compiled. If that's "foo.c", for example,
optimization records are output to "foo.opt.yaml".
+.. _opt_foptimization-record-passes:
+
+**-foptimization-record-passes**
+ Only include passes which match a specified regular expression.
+
+ When optimization reports are being output (see
+ :ref:`-fsave-optimization-record <opt_fsave-optimization-record>`), this
+ option controls the passes that will be included in the final report.
+
+ If this option is not used, all the passes are included in the optimization
+ record.
+
.. _opt_fdiagnostics-show-hotness:
**-f[no-]diagnostics-show-hotness**
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index ffecccba16a..b66aa22964d 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -229,7 +229,7 @@ def err_drv_gnustep_objc_runtime_incompatible_binary : Error<
def err_drv_emit_llvm_link : Error<
"-emit-llvm cannot be used when linking">;
def err_drv_optimization_remark_pattern : Error<
- "%0 in '%1'">;
+ "in pattern '%1': %0">;
def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, please use [no]simd instead">;
def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
def err_drv_omp_host_ir_file_not_found : Error<
diff --git a/clang/test/CodeGen/opt-record.c b/clang/test/CodeGen/opt-record.c
index 3f134854fe5..da32f357282 100644
--- a/clang/test/CodeGen/opt-record.c
+++ b/clang/test/CodeGen/opt-record.c
@@ -5,6 +5,7 @@
// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK -check-prefix=CHECK-PGO %s
// RUN: %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-record-file %t.yaml -opt-record-passes inline -emit-obj
// RUN: cat %t.yaml | FileCheck -check-prefix=CHECK-PASSES %s
+// RUN: not %clang_cc1 -O3 -triple x86_64-unknown-linux-gnu -target-cpu x86-64 %s -o %t -dwarf-column-info -opt-record-file %t.yaml -opt-record-passes "(foo" -emit-obj 2>&1 | FileCheck -check-prefix=CHECK-PATTERN-ERROR %s
// REQUIRES: x86-registered-target
void bar();
@@ -34,3 +35,5 @@ void Test(int *res, int *c, int *d, int *p, int n) {
// CHECK: Function: Test
// CHECK-PGO: Hotness:
// CHECK-PASSES-NOT: loop-vectorize
+
+// CHECK-PATTERN-ERROR: error: in pattern '(foo': parentheses not balanced
diff --git a/llvm/test/tools/gold/X86/opt-remarks.ll b/llvm/test/tools/gold/X86/opt-remarks.ll
index 548f228d28d..4f8ae2c843c 100644
--- a/llvm/test/tools/gold/X86/opt-remarks.ll
+++ b/llvm/test/tools/gold/X86/opt-remarks.ll
@@ -2,9 +2,11 @@
; RUN: llvm-as %s -o %t.o
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \
; RUN: -plugin-opt=save-temps \
+; RUN: -plugin-opt=opt-remarks-passes=inline \
; RUN: -plugin-opt=opt-remarks-filename=%t.yaml %t.o -o %t2.o 2>&1
; RUN: llvm-dis %t2.o.0.4.opt.bc -o - | FileCheck %s
; RUN: %gold -m elf_x86_64 -plugin %llvmshlibdir/LLVMgold%shlibext -shared \
+; RUN: -plugin-opt=opt-remarks-passes=inline \
; RUN: -plugin-opt=opt-remarks-with-hotness \
; RUN: -plugin-opt=opt-remarks-filename=%t.hot.yaml %t.o -o %t2.o 2>&1
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
OpenPOWER on IntegriCloud