From: Than McIntosh Date: Fri, 28 Oct 2022 17:21:36 +0000 (-0400) Subject: cmd/compile: revise inliner coverage tweaks (again) X-Git-Tag: go1.20rc1~480 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=317f2a7df63df89455ee4fd2721620a853c7fda1;p=gostls13.git 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 TryBot-Result: Gopher Robot Run-TryBot: Than McIntosh --- diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index 4909650ae4..75f3a4b907 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -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 {