mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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 <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
70ed28e5f7
commit
33d99905da
1 changed files with 13 additions and 0 deletions
|
|
@ -1449,6 +1449,19 @@ func expandCalls(f *Func) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 6: elide any copies introduced.
|
// 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 _, b := range f.Blocks {
|
||||||
for _, v := range b.Values {
|
for _, v := range b.Values {
|
||||||
for i, a := range v.Args {
|
for i, a := range v.Args {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue