]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: remove a couple CloneName calls
authorMatthew Dempsky <mdempsky@google.com>
Sun, 3 Jan 2021 08:53:51 +0000 (00:53 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 3 Jan 2021 19:48:20 +0000 (19:48 +0000)
In inl.go, that code path is unused, since we added ir.BasicLit to
represent unnamed OLITERALs.

In race.go, rather than cloning ir.RegFP, we can just create it from
scratch again.

Passes toolstash -cmp (incl. w/ -race).

Change-Id: I8e063e4898d2acf056ceca5bc03df6b40a14eca9
Reviewed-on: https://go-review.googlesource.com/c/go/+/281192
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>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/walk/race.go

index 2887abb0614d48c9a71d68bd3aa8197195f54237..b9b424b74d9e4fb0fcfed590405c0d3f24d60146 100644 (file)
@@ -1096,15 +1096,6 @@ func (subst *inlsubst) node(n ir.Node) ir.Node {
                if n.Sym() != nil {
                        return n
                }
-               if n, ok := n.(*ir.Name); ok && n.Op() == ir.OLITERAL {
-                       // This happens for unnamed OLITERAL.
-                       // which should really not be a *Name, but for now it is.
-                       // ir.Copy(n) is not allowed generally and would panic below,
-                       // but it's OK in this situation.
-                       n = n.CloneName()
-                       n.SetPos(subst.updatedPos(n.Pos()))
-                       return n
-               }
 
        case ir.ORETURN:
                // Since we don't handle bodies with closures,
index 87a8839dcd02e106ed4c6e9378d7ab0560d1e53b..20becf9be93d64d3bc89cdcc6adfaa6fe702820a 100644 (file)
@@ -8,6 +8,7 @@ import (
        "cmd/compile/internal/base"
        "cmd/compile/internal/ir"
        "cmd/compile/internal/ssagen"
+       "cmd/compile/internal/typecheck"
        "cmd/compile/internal/types"
        "cmd/internal/src"
        "cmd/internal/sys"
@@ -36,7 +37,10 @@ func instrument(fn *ir.Func) {
                        // This only works for amd64. This will not
                        // work on arm or others that might support
                        // race in the future.
-                       nodpc := ir.RegFP.CloneName()
+
+                       nodpc := ir.NewNameAt(src.NoXPos, typecheck.Lookup(".fp"))
+                       nodpc.Class_ = ir.PPARAM
+                       nodpc.SetUsed(true)
                        nodpc.SetType(types.Types[types.TUINTPTR])
                        nodpc.SetFrameOffset(int64(-types.PtrSize))
                        fn.Dcl = append(fn.Dcl, nodpc)