mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: use ir.Find for "search" traversals
This CL converts all the generic searching traversal to use ir.Find instead of relying on direct access to Left, Right, and so on. Passes buildall w/ toolstash -cmp. Change-Id: I4d951aef630c00bf333f24be79565cc564694d04 Reviewed-on: https://go-review.googlesource.com/c/go/+/275372 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
0d1b44c645
commit
b9df26d7a8
7 changed files with 247 additions and 341 deletions
|
|
@ -60,7 +60,8 @@ func (s *InitSchedule) tryStaticInit(n ir.Node) bool {
|
|||
if n.Op() != ir.OAS {
|
||||
return false
|
||||
}
|
||||
if ir.IsBlank(n.Left()) && candiscard(n.Right()) {
|
||||
if ir.IsBlank(n.Left()) && !hasSideEffects(n.Right()) {
|
||||
// Discard.
|
||||
return true
|
||||
}
|
||||
lno := setlineno(n)
|
||||
|
|
@ -548,7 +549,8 @@ func fixedlit(ctxt initContext, kind initKind, n ir.Node, var_ ir.Node, init *ir
|
|||
|
||||
for _, r := range n.List().Slice() {
|
||||
a, value := splitnode(r)
|
||||
if a == ir.BlankNode && candiscard(value) {
|
||||
if a == ir.BlankNode && !hasSideEffects(value) {
|
||||
// Discard.
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue