[0/3] Higher-level reporting of vectorization problems (v3)

Message ID 1538161880-64793-1-git-send-email-dmalcolm@redhat.com
Headers show
Series
  • Higher-level reporting of vectorization problems (v3)
Related show

Message

David Malcolm Sept. 28, 2018, 7:11 p.m.
This is v3 of this patch kit; previous versions were:
  v2: https://gcc.gnu.org/ml/gcc-patches/2018-07/msg00446.html
  v1: https://gcc.gnu.org/ml/gcc-patches/2018-06/msg01462.html

The overall goal of this patch kit is to make the output of
-fopt-info more readable for technically-advanced end-users,
whilst preserving the existing output for dump files.

The aim is to (by default) replace the current "wall of text"
output for -fopt-info-vec-all with a summary of the status for
each loop, giving either:

  <LOOP-LOCATION>: vectorized this loop via <METHOD>

or:

  <LOOP-LOCATION>: couldn't vectorize this loop
  <PROBLEM-LOCATION>: because of <REASON>

In particular, the "reason" message uses the location of the
problematic construct, rather than reusing that of the loop.
  
For example:
    
  no-vfa-vect-102.c:24:3: missed: couldn't vectorize loop
  no-vfa-vect-102.c:27:7: missed: statement clobbers memory: __asm__ __volatile__("" :  :  : "memory");

Patch 1 fixes an bug in -fopt-info with plugin passes, needed by
the other patches since they add a plugin to the testsuite to test
-fopt-info output.

Patches 2 and 3 introduce a verbosity level to dump messages:
"user-facing" vs "internals", suppressing "internals" messages by
default within -fopt-info, along with a way to propagate
information about a specific problem back up to the top level
and report it (class opt_problem), and a way to re-enable the
"internals" output in -fopt-info; see those patches for more
information.

The patches now bootstrap & pass regression testing on
x86_64-pc-linux-gnu; I'm hoping to get this into trunk for GCC 9.

Thanks
Dave

David Malcolm (3):
  Fix -fopt-info for plugin passes
  Add -fopt-info-internals
  v3: Report vectorization problems via a new opt_problem class

 gcc/Makefile.in                                    |   1 +
 gcc/doc/invoke.texi                                |  31 +-
 gcc/dump-context.h                                 | 106 ++++-
 gcc/dumpfile.c                                     | 490 ++++++++++++---------
 gcc/dumpfile.h                                     |  60 ++-
 gcc/opt-problem.cc                                 | 335 ++++++++++++++
 gcc/opt-problem.h                                  | 289 ++++++++++++
 gcc/optinfo-emit-json.cc                           |   2 +-
 gcc/optinfo.cc                                     |  44 +-
 gcc/optinfo.h                                      |   7 +-
 gcc/passes.c                                       |  30 +-
 gcc/selftest-run-tests.c                           |   1 +
 gcc/selftest.h                                     |   1 +
 gcc/testsuite/gcc.dg/plugin/dump-1.c               |  24 +
 gcc/testsuite/gcc.dg/plugin/dump-2.c               |  30 ++
 gcc/testsuite/gcc.dg/plugin/dump_plugin.c          | 143 ++++++
 gcc/testsuite/gcc.dg/plugin/plugin.exp             |   3 +
 gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c |  12 +
 gcc/testsuite/gcc.dg/vect/vect-alias-check-4.c     |  18 +-
 gcc/tree-data-ref.c                                |  70 ++-
 gcc/tree-data-ref.h                                |  10 +-
 gcc/tree-predcom.c                                 |   3 +-
 gcc/tree-vect-data-refs.c                          | 347 +++++++--------
 gcc/tree-vect-loop-manip.c                         |   6 +-
 gcc/tree-vect-loop.c                               | 442 ++++++++-----------
 gcc/tree-vect-slp.c                                |   4 +-
 gcc/tree-vect-stmts.c                              | 275 +++++-------
 gcc/tree-vectorizer.c                              |  17 +-
 gcc/tree-vectorizer.h                              |  51 ++-
 29 files changed, 1932 insertions(+), 920 deletions(-)
 create mode 100644 gcc/opt-problem.cc
 create mode 100644 gcc/opt-problem.h
 create mode 100644 gcc/testsuite/gcc.dg/plugin/dump-1.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/dump-2.c
 create mode 100644 gcc/testsuite/gcc.dg/plugin/dump_plugin.c
 create mode 100644 gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c

-- 
1.8.5.3