]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: allow SSA of multi-field structs while instrumenting
authorMatthew Dempsky <mdempsky@google.com>
Wed, 25 Apr 2018 19:36:36 +0000 (12:36 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 26 Apr 2018 07:07:18 +0000 (07:07 +0000)
commit736390c2bd2d7f00d62ca62f18836f82eb1f51a3
tree719ffa3ccb5cf51abcf1aa39becb0f808240d386
parent58c231f244feda52f66dd4692229f740d3c3b988
cmd/compile: allow SSA of multi-field structs while instrumenting

When we moved racewalk to buildssa, we disabled SSA of structs with
2-4 fields while instrumenting because it caused false dependencies
because for "x.f" we would emit

    (StructSelect (Load (Addr x)) "f")

Even though we later simplify this to

    (Load (OffPtr (Addr x) "f"))

the instrumentation saw a load of x in its entirety and would issue
appropriate race/msan calls.

The fix taken here is to directly emit the OffPtr form when x.f is
addressable and can't be represented in SSA form.

Change-Id: I0caf37bced52e9c16937466b0ac8cab6d356e525
Reviewed-on: https://go-review.googlesource.com/109360
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/gc/ssa.go