compiler: avoid introducing redundant write barriers
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 13 Jun 2018 20:32:10 +0000 (20:32 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 13 Jun 2018 20:32:10 +0000 (20:32 +0000)
commit1df5fce42a295ae8cb34c6a4aae30814679b0b59
tree0dd19ecdee4854a48eb38384caaf3269c7fc8e20
parenta7bf6c088934ef39a937069fca7408c7f540c551
compiler: avoid introducing redundant write barriers

    The traversal used by the write barrier insertion phase can sometimes
    wind up visiting new statements inserted during the traversal, which
    then results in duplicate / redundant write barrier guards. Example
    program to reproduce:

      package small
      type S struct {
            N *S
            K int
      }
      var G *S = &S{N: nil, K: 101}

    This patch changes the traversal code to keep track of statements
    already added and avoid processing them again later in the traversal.

    Fixes golang/go#25867

    Reviewed-on: https://go-review.googlesource.com/118637

From-SVN: r261568
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/wb.cc