diff options
| author | Matthew Dempsky <mdempsky@google.com> | 2023-08-18 00:09:06 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-08-18 22:41:47 +0000 |
| commit | 7af28fa90ec2ce4c90ca47b6bc3e348ac8cb133a (patch) | |
| tree | dc41f3af7b62c7dcc73791e43fe5a09fb39550ac /src/cmd/compile/internal/reflectdata | |
| parent | 4089b6a5b13282a2fd3d1ec5b1a2d67825c5e6b2 (diff) | |
| download | go-7af28fa90ec2ce4c90ca47b6bc3e348ac8cb133a.tar.xz | |
cmd/compile/internal/ir: remove AsNode
Except for a single call site in escape analysis, every use of
ir.AsNode involves a types.Object that's known to contain
an *ir.Name. Asserting directly to that type makes the code simpler
and more efficient.
The one use in escape analysis is extended to handle nil correctly
without it.
Change-Id: I694ae516903e541341d82c2f65a9155e4b0a9809
Reviewed-on: https://go-review.googlesource.com/c/go/+/520775
TryBot-Bypass: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/cmd/compile/internal/reflectdata')
| -rw-r--r-- | src/cmd/compile/internal/reflectdata/alg.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/reflectdata/alg.go b/src/cmd/compile/internal/reflectdata/alg.go index d46b0cd360..01135de39f 100644 --- a/src/cmd/compile/internal/reflectdata/alg.go +++ b/src/cmd/compile/internal/reflectdata/alg.go @@ -153,8 +153,8 @@ func hashFunc(t *types.Type) *ir.Func { sym.Def = fn.Nname fn.Pragma |= ir.Noinline // TODO(mdempsky): We need to emit this during the unified frontend instead, to allow inlining. - np := ir.AsNode(fn.Type().Params().Field(0).Nname) - nh := ir.AsNode(fn.Type().Params().Field(1).Nname) + np := fn.Type().Params().Field(0).Nname.(*ir.Name) + nh := fn.Type().Params().Field(1).Nname.(*ir.Name) switch t.Kind() { case types.TARRAY: @@ -375,9 +375,9 @@ func eqFunc(t *types.Type) *ir.Func { sym.Def = fn.Nname fn.Pragma |= ir.Noinline // TODO(mdempsky): We need to emit this during the unified frontend instead, to allow inlining. - np := ir.AsNode(fn.Type().Params().Field(0).Nname) - nq := ir.AsNode(fn.Type().Params().Field(1).Nname) - nr := ir.AsNode(fn.Type().Results().Field(0).Nname) + np := fn.Type().Params().Field(0).Nname.(*ir.Name) + nq := fn.Type().Params().Field(1).Nname.(*ir.Name) + nr := fn.Type().Results().Field(0).Nname.(*ir.Name) // Label to jump to if an equality test fails. neq := typecheck.AutoLabel(".neq") |
