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: