1
0
mirror of https://github.com/golang/go synced 2024-11-17 16:04:47 -07:00

cmd/compile: revise inliner coverage tweaks (again)

This patch fixes a typo/bug introduced in CL 441858 where when pattern
matching a coverage counter access we were looking at an assingment
node instead of the assignment LHS, and fixes a similar problem in
atomic counter update pattern matching introduced in CL 444835. In
both of these cases the bug was not caught because the test intended
to lock down the behavior was written incorrectly (wasn't
instrumenting what the test author thought it was instrumenting,
ouch).

Change-Id: I6e6ac3beacf12ef1a817de5527340b639f0bb044
Reviewed-on: https://go-review.googlesource.com/c/go/+/446258
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
This commit is contained in:
Than McIntosh 2022-10-28 13:21:36 -04:00
parent 2730170f63
commit 317f2a7df6

View File

@ -412,7 +412,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
// failures (a good example is the TestAllocations in
// crypto/ed25519).
if isAtomicCoverageCounterUpdate(n) {
break
return false
}
}
if n.X.Op() == ir.OMETHEXPR {
@ -629,7 +629,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
// then result in test failures (a good example is the
// TestAllocations in crypto/ed25519).
n := n.(*ir.AssignStmt)
if n.X.Op() == ir.OINDEX && isIndexingCoverageCounter(n) {
if n.X.Op() == ir.OINDEX && isIndexingCoverageCounter(n.X) {
return false
}
}
@ -1729,7 +1729,8 @@ func isAtomicCoverageCounterUpdate(cn *ir.CallExpr) bool {
return false
}
fn := name.Sym().Name
if name.Sym().Pkg.Path != "sync/atomic" || fn != "AddUint32" {
if name.Sym().Pkg.Path != "sync/atomic" ||
(fn != "AddUint32" && fn != "StoreUint32") {
return false
}
if len(cn.Args) != 2 || cn.Args[0].Op() != ir.OADDR {