diff options
author | Matthew Dempsky <mdempsky@google.com> | 2020-12-26 21:33:17 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2020-12-28 07:44:35 +0000 |
commit | 676d794b8119a40aaa0aa00124f367bd72eeff9c (patch) | |
tree | 2a6229052fced373d7185d0cde1b4e0f79692a75 /src/cmd/compile/internal/walk/complit.go | |
parent | c98548e1109e9fbe29ef2a8c7c275b241aaacd3b (diff) | |
download | go-676d794b8119a40aaa0aa00124f367bd72eeff9c.tar.gz go-676d794b8119a40aaa0aa00124f367bd72eeff9c.zip |
[dev.regabi] cmd/compile: remove refersToCommonName
After reorder3's simplification, the only remaining use of
refersToCommonName is in oaslit, where the LHS expression is always a
single name. We can replace the now overly-generalized
refersToCommonName with a simple ir.Any traversal with ir.Uses.
Passes toolstash -cmp.
Change-Id: Ice3020cdbbf6083d52e07866a687580f4eb134b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/280439
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/walk/complit.go')
-rw-r--r-- | src/cmd/compile/internal/walk/complit.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/walk/complit.go b/src/cmd/compile/internal/walk/complit.go index b53fe2e935a..8c4f9583ef5 100644 --- a/src/cmd/compile/internal/walk/complit.go +++ b/src/cmd/compile/internal/walk/complit.go @@ -629,6 +629,7 @@ func oaslit(n *ir.AssignStmt, init *ir.Nodes) bool { // not a special composite literal assignment return false } + x := n.X.(*ir.Name) if !types.Identical(n.X.Type(), n.Y.Type()) { // not a special composite literal assignment return false @@ -640,7 +641,7 @@ func oaslit(n *ir.AssignStmt, init *ir.Nodes) bool { return false case ir.OSTRUCTLIT, ir.OARRAYLIT, ir.OSLICELIT, ir.OMAPLIT: - if refersToCommonName(n.X, n.Y) { + if ir.Any(n.Y, func(y ir.Node) bool { return ir.Uses(y, x) }) { // not a special composite literal assignment return false } |