]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: optimize loads from abi.Type.{Size_,PtrBytes,Kind_}
authorJake Bailey <jacob.b.bailey@gmail.com>
Fri, 5 Sep 2025 20:36:47 +0000 (13:36 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 8 Sep 2025 20:34:06 +0000 (13:34 -0700)
commit5b218461f98b354ac9bde4fdd4f7046fdf2d2029
tree9068dc49b4388206691bae6b116bc7bed6637bcb
parentb915e14490e1c3ac5a84c274bfab647e1cb105a7
cmd/compile: optimize loads from abi.Type.{Size_,PtrBytes,Kind_}

With the previous CL in place, we can now pretty easily optimize a few
more loads from abi.Type. I've done Size_, PtrBytes, and Kind_, which
are easily calculated.

Among std/cmd, this rule fires a number of times:

     75 abi.Type field Kind_
     50 abi.PtrType field Elem
     14 abi.Type field Hash
      4 abi.Type field Size_
      2 abi.Type field PtrBytes

The other ones that show up when compiling std/cmd are TFlag and GCData,
but these are not trivially calculated. Doing TFlag would probably be a
decent help given it's often used in things like switches where
statically knowing the kind could eliminate a bunch of dead code.

Change-Id: Ic7fd2113fa7479af914d06916edbca60cc71819f
Reviewed-on: https://go-review.googlesource.com/c/go/+/701298
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/compile/internal/ssa/rewrite.go