compiler: recognize and optimize array range clear
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 3 May 2019 21:45:35 +0000 (21:45 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 3 May 2019 21:45:35 +0000 (21:45 +0000)
commit08c8a26e9ca87ad2dd5b26d397e6107b68adfe76
tree72997940c63241636375f8e4b4565d8f6301b724
parente339291fc13d074bade3fd9ab3cbfacce5a21cbd
compiler: recognize and optimize array range clear

    Recognize

            for i := range a { a[i] = zero }

    for array or slice a, and rewrite it to call memclr, as the gc
    compiler does.

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

From-SVN: r270862
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/runtime.def
gcc/go/gofrontend/statements.cc
gcc/go/gofrontend/statements.h
libgo/go/runtime/mbarrier.go