compiler: avoid introducing redundant write barriers
commita0b809c3e41fe8d2ea1bdab71ccd9f0aa060345c
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2018 20:32:10 +0000 (13 20:32 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2018 20:32:10 +0000 (13 20:32 +0000)
tree0dd19ecdee4854a48eb38384caaf3269c7fc8e20
parentf35f3d9a403cefddaa9febec0662befa49091719
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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261568 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/wb.cc