compiler: add an option to emit optimization diagnostics
authorCherry Zhang <cherryyz@google.com>
Wed, 8 May 2019 00:14:17 +0000 (00:14 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 8 May 2019 00:14:17 +0000 (00:14 +0000)
commitf837b9c41a6ca8be317a762410fb7811b3fddde6
treef8579ea0f1e87d926a24f76f63ead381e96c34be
parenta88158bc4daca182f0f39a2b667223d13b5a46e6
compiler: add an option to emit optimization diagnostics

    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.

From-SVN: r270993
13 files changed:
gcc/go/ChangeLog
gcc/go/gccgo.texi
gcc/go/go-c.h
gcc/go/go-lang.c
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/go.cc
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/statements.cc
gcc/go/lang.opt
gcc/testsuite/ChangeLog
gcc/testsuite/go.dg/arrayclear.go [new file with mode: 0644]
gcc/testsuite/go.dg/mapclear.go [new file with mode: 0644]