cmd/compile/internal/typecheck: merge SubstArgTypes into LookupRuntime

LookupRuntime is the only reason for using SubstArgTypes, and most
callers to LookupRuntime need to immediately call it anyway. So might
as well fuse them together.

Change-Id: Ie0724ed164b949040e898a2a77bea632801b64fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/521415
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
Matthew Dempsky 2023-08-20 16:14:50 -07:00 committed by Gopher Robot
parent c6dd97e533
commit 08a08083c1
8 changed files with 48 additions and 82 deletions

View file

@ -249,9 +249,7 @@ func hashFunc(t *types.Type) *ir.Func {
}
func runtimeHashFor(name string, t *types.Type) *ir.Name {
n := typecheck.LookupRuntime(name)
n = typecheck.SubstArgTypes(n, t)
return n
return typecheck.LookupRuntime(name, t)
}
// hashfor returns the function to compute the hash of a value of type t.
@ -647,9 +645,7 @@ func eqFunc(t *types.Type) *ir.Func {
func EqFor(t *types.Type) (ir.Node, bool) {
switch a, _ := types.AlgType(t); a {
case types.AMEM:
n := typecheck.LookupRuntime("memequal")
n = typecheck.SubstArgTypes(n, t, t)
return n, true
return typecheck.LookupRuntime("memequal", t, t), true
case types.ASPECIAL:
fn := eqFunc(t)
return fn.Nname, false
@ -667,7 +663,5 @@ func anyCall(fn *ir.Func) bool {
}
func hashmem(t *types.Type) ir.Node {
n := typecheck.LookupRuntime("memhash")
n = typecheck.SubstArgTypes(n, t)
return n
return typecheck.LookupRuntime("memhash", t)
}