compiler: add an option to emit optimization diagnostics

Programming / Compilers / GCC - ian [138bc75d-0d04-0410-961f-82ee72b054a4] - 8 May 2019 00:14 EDT

Add a -fgo-debug-optimization option to emit optimization diagnostics. This can be used for testing optimizations. Apply this to the range clear optimizations of maps and arrays.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/170002

gcc/go:

- lang.opt (-fgo-debug-optimization): New option.
- go-c.h (struct go_create_gogo_args): Add debug_optimization field.
- go-lang.c (go_langhook_init): Set debug_optimization field.
- gccgo.texi (Invoking gccgo): Document -fgo-debug-optimization.

gcc/testsuite:

- go.dg/arrayclear.go: New test.
- go.dg/mapclear.go: New test.

8dc24d984d8 compiler: add an option to emit optimization diagnostics
gcc/go/ChangeLog | 8 ++++++++
gcc/go/gccgo.texi | 5 +++++
gcc/go/go-c.h | 1 +
gcc/go/go-lang.c | 1 +
gcc/go/gofrontend/MERGE | 2 +-
gcc/go/gofrontend/go.cc | 2 ++
gcc/go/gofrontend/gogo.cc | 1 +
gcc/go/gofrontend/gogo.h | 13 +++++++++++++
gcc/go/gofrontend/statements.cc | 4 ++++
gcc/go/lang.opt | 4 ++++
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/go.dg/arrayclear.go | 20 ++++++++++++++++++++
gcc/testsuite/go.dg/mapclear.go | 10 ++++++++++
13 files changed, 75 insertions(+), 1 deletion(-)

Upstream: gcc.gnu.org


  • Share