1
0
mirror of https://github.com/golang/go synced 2024-11-22 14:44:50 -07:00

[dev.regabi] cmd/compile: only save ONAMEs on Curfn.Dcl

There's not really any use to tracking function-scoped constants and
types on Curfn.Dcl, and there's sloppy code that assumes all of the
declarations are variables (e.g., cmpstackvarlt).

Change-Id: I5d10dc681dac2c161c7b73ba808403052ca0608e
Reviewed-on: https://go-review.googlesource.com/c/go/+/274436
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Matthew Dempsky 2020-12-01 03:52:20 -08:00
parent a17c5e2fce
commit 6ca23a45fe
2 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ func declare(n *ir.Name, ctxt ir.Class) {
base.Pos = n.Pos()
base.Fatalf("automatic outside function")
}
if Curfn != nil && ctxt != ir.PFUNC {
if Curfn != nil && ctxt != ir.PFUNC && n.Op() == ir.ONAME {
Curfn.Dcl = append(Curfn.Dcl, n)
}
if n.Op() == ir.OTYPE {

View File

@ -718,5 +718,5 @@ func f44(f func() [2]*int) interface{} { // ERROR "live at entry to f44: f"
}
ret := T{}
ret.s[0] = f()
return ret // ERROR "stack object .autotmp_5 T"
return ret // ERROR "stack object .autotmp_[0-9]+ T"
}