From: Cherry Zhang Date: Sun, 11 Apr 2021 16:07:33 +0000 (-0400) Subject: cmd/compile: preserve name association when eliding copies in expand_calls X-Git-Tag: go1.17beta1~716 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=33d99905da;p=gostls13.git cmd/compile: preserve name association when eliding copies in expand_calls If v is a Copy of x, we will rewrite v to x. If v has a name associated to it, let the name associate to x. Under register ABI, this helps associate in-register Arg values to the parameters' names. (But does not address all cases.) Change-Id: I47c779e56c9d0823a88890497e32326bc0290f82 Reviewed-on: https://go-review.googlesource.com/c/go/+/309330 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: David Chase Reviewed-by: Than McIntosh --- diff --git a/src/cmd/compile/internal/ssa/expand_calls.go b/src/cmd/compile/internal/ssa/expand_calls.go index cb8b2eeec8..d947443cb2 100644 --- a/src/cmd/compile/internal/ssa/expand_calls.go +++ b/src/cmd/compile/internal/ssa/expand_calls.go @@ -1449,6 +1449,19 @@ func expandCalls(f *Func) { } // Step 6: elide any copies introduced. + // Update named values. + for _, name := range f.Names { + values := f.NamedValues[name] + for i, v := range values { + if v.Op == OpCopy { + a := v.Args[0] + for a.Op == OpCopy { + a = a.Args[0] + } + values[i] = a + } + } + } for _, b := range f.Blocks { for _, v := range b.Values { for i, a := range v.Args {