aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2021-05-04 13:24:11 -0400
committerThan McIntosh <thanm@google.com>2021-05-04 19:56:15 +0000
commitf62739b8611a0f1c96e59eb6574422562bb46233 (patch)
treeee5428662b81326356f3320bbf74f1c5cea1d57e /src/cmd/compile/internal/ssa
parent8c3d217d89e718a5d9b7d8f4b1336907f15ea50c (diff)
downloadgo-f62739b8611a0f1c96e59eb6574422562bb46233.tar.gz
go-f62739b8611a0f1c96e59eb6574422562bb46233.zip
cmd/compile: establish regabi name/value mapping for small in-params
When the expand_calls phase in the SSA backend lowers prolog OpArg values into OpArgIntReg/OpArgFloatReg values, we don't always record the assocation between the new lowered value and the parameter name. This patch handles the simple case where a given parameter fits into exactly one register; in this scenario it makes sense to manufacture a new pseudo-slot for the value that points to the param, and install the slot/value mapping in the NamedValues table for the function. More work will be needed to deal with params that span multiple registers; that will need to be addressed in a subsequent patch. This change improves the parameter error rate "optargorder" benchmark by about 7-8% (when run on the optargorder binary). Updates #45945. Change-Id: Ic9adbe20b6f91145d49651348818f0f5cba92b18 Reviewed-on: https://go-review.googlesource.com/c/go/+/316890 Trust: Than McIntosh <thanm@google.com> Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa')
-rw-r--r--src/cmd/compile/internal/ssa/expand_calls.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/expand_calls.go b/src/cmd/compile/internal/ssa/expand_calls.go
index 39d0b61c2e..2852753bee 100644
--- a/src/cmd/compile/internal/ssa/expand_calls.go
+++ b/src/cmd/compile/internal/ssa/expand_calls.go
@@ -1714,6 +1714,21 @@ func (x *expandState) newArgToMemOrRegs(baseArg, toReplace *Value, offset int64,
} else {
w = baseArg.Block.NewValue0IA(pos, op, t, auxInt, aux)
}
+ // If we are creating an OpArgIntReg/OpArgFloatReg that
+ // corresponds to an in-param that fits entirely in a register,
+ // then enter it into the name/value table. The LocalSlot
+ // is somewhat fictitious, since there is no incoming live
+ // memory version of the parameter, but we need an entry in
+ // NamedValues in order for ssa debug tracking to include
+ // the value in the tracking analysis.
+ if len(pa.Registers) == 1 {
+ loc := LocalSlot{N: aux.Name, Type: t, Off: 0}
+ values, ok := x.f.NamedValues[loc]
+ if !ok {
+ x.f.Names = append(x.f.Names, loc)
+ }
+ x.f.NamedValues[loc] = append(values, w)
+ }
x.commonArgs[key] = w
if toReplace != nil {
toReplace.copyOf(w)