]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: only save ONAMEs on Curfn.Dcl
authorMatthew Dempsky <mdempsky@google.com>
Tue, 1 Dec 2020 11:52:20 +0000 (03:52 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 1 Dec 2020 17:16:53 +0000 (17:16 +0000)
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>

src/cmd/compile/internal/gc/dcl.go
test/live.go

index 637587392aa448ab66706b6ee8d865279c3bb3cd..3b60496c5c689cfb711948ad35cca5d35b286805 100644 (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 {
index 3df7ab01af47f693885bc05bdfe08873ffdbed8c..d52ce7f0075017a7669d0a4fbdb6515291055379 100644 (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"
 }