From de561dc7664c9792964d8fa74a3aa02263ee36b9 Mon Sep 17 00:00:00 2001 From: Jakub Ciolek Date: Wed, 25 May 2022 12:22:22 +0200 Subject: [PATCH] cmd/compile: mark booleans as registerizable MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Boolean values fit in registers, mark them accordingly. Improves codegen a bit. compilecmp for darwin/amd64: compress/gzip compress/gzip.(*Reader).Reset 1017 -> 985 (-3.15%) net net.newRequest 1002 -> 970 (-3.19%) crypto/tls crypto/tls.(*sessionState).unmarshal 1054 -> 968 (-8.16%) cmd/compile/internal/syntax cmd/compile/internal/syntax.Fprint 518 -> 453 (-12.55%) cmd/vendor/github.com/ianlancetaylor/demangle cmd/vendor/github.com/ianlancetaylor/demangle.ASTToString 389 -> 325 (-16.45%) cmd/go/internal/load cmd/go/internal/load.PackagesAndErrors 3453 -> 3381 (-2.09%) cmd/compile/internal/ssa cmd/compile/internal/ssa.registerizable 249 -> 255 (+2.41%) cmd/compile/internal/ssagen cmd/compile/internal/ssagen.buildssa 9388 -> 9356 (-0.34%) file before after Δ % compress/gzip.s 8247 8215 -32 -0.388% net.s 266667 266635 -32 -0.012% crypto/tls.s 290324 290238 -86 -0.030% cmd/compile/internal/syntax.s 156422 156357 -65 -0.042% cmd/vendor/github.com/ianlancetaylor/demangle.s 268313 268249 -64 -0.024% cmd/go/internal/load.s 122946 122874 -72 -0.059% cmd/compile/internal/ssa.s 3551201 3551207 +6 +0.000% cmd/compile/internal/ssagen.s 362299 362267 -32 -0.009% total 19725872 19725495 -377 -0.002% Change-Id: I4cd40b54d8b2da6d1f946e51f16689315a369dca Reviewed-on: https://go-review.googlesource.com/c/go/+/408474 Run-TryBot: Keith Randall Reviewed-by: Keith Randall Reviewed-by: David Chase Run-TryBot: Keith Randall TryBot-Result: Gopher Robot Reviewed-by: Keith Randall --- src/cmd/compile/internal/ssa/rewrite.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go index 15a5cf6136..58f1fe9249 100644 --- a/src/cmd/compile/internal/ssa/rewrite.go +++ b/src/cmd/compile/internal/ssa/rewrite.go @@ -1632,7 +1632,7 @@ func sizeof(t interface{}) int64 { // a register. It assumes float64 values will always fit into registers // even if that isn't strictly true. func registerizable(b *Block, typ *types.Type) bool { - if typ.IsPtrShaped() || typ.IsFloat() { + if typ.IsPtrShaped() || typ.IsFloat() || typ.IsBoolean() { return true } if typ.IsInteger() { -- 2.50.0