aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/zcse.go
diff options
context:
space:
mode:
authorDave Cheney <dave@cheney.net>2016-03-18 13:21:53 +1100
committerDave Cheney <dave@cheney.net>2016-03-23 11:02:26 +0000
commite6beec1fc81ebf8445e23254291dce331b104668 (patch)
tree2d9f521b834f068f765f18bb49e242c646f76baf /src/cmd/compile/internal/ssa/zcse.go
parenta4be24cbe6b10ee66674834d571c196622ff55ed (diff)
downloadgo-e6beec1fc81ebf8445e23254291dce331b104668.tar.gz
go-e6beec1fc81ebf8445e23254291dce331b104668.zip
cmd/compile/internal/ssa: avoid string conversion in zcse
Some ssa.Type implementations fell through to gc.Tconv which generated garbage to produce a string form of the Type. name old time/op new time/op delta Template 405ms ± 7% 401ms ± 6% ~ (p=0.478 n=20+20) GoTypes 1.32s ± 1% 1.30s ± 2% -1.27% (p=0.000 n=19+20) Compiler 6.07s ± 2% 6.03s ± 2% ~ (p=0.121 n=20+20) name old alloc/op new alloc/op delta Template 63.9MB ± 0% 63.7MB ± 0% -0.21% (p=0.000 n=19+20) GoTypes 220MB ± 0% 219MB ± 0% -0.21% (p=0.000 n=20+20) Compiler 966MB ± 0% 965MB ± 0% -0.11% (p=0.000 n=20+20) name old allocs/op new allocs/op delta Template 708k ± 0% 701k ± 0% -0.99% (p=0.000 n=20+20) GoTypes 2.20M ± 0% 2.17M ± 0% -1.43% (p=0.000 n=17+20) Compiler 9.45M ± 0% 9.36M ± 0% -0.91% (p=0.000 n=20+20) Change-Id: I5fcc30e0f76a823d1c301d4980b583d716a75ce3 Reviewed-on: https://go-review.googlesource.com/20844 Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/zcse.go')
-rw-r--r--src/cmd/compile/internal/ssa/zcse.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/cmd/compile/internal/ssa/zcse.go b/src/cmd/compile/internal/ssa/zcse.go
index dbda53e8a2..16d5c10331 100644
--- a/src/cmd/compile/internal/ssa/zcse.go
+++ b/src/cmd/compile/internal/ssa/zcse.go
@@ -17,7 +17,7 @@ func zcse(f *Func) {
v := b.Values[i]
next := true
if opcodeTable[v.Op].argLen == 0 {
- key := vkey{v.Op, keyFor(v), v.Aux, typeStr(v)}
+ key := vkey{v.Op, keyFor(v), v.Aux, v.Type}
if vals[key] == nil {
vals[key] = v
if b != f.Entry {
@@ -46,7 +46,7 @@ func zcse(f *Func) {
for _, v := range b.Values {
for i, a := range v.Args {
if opcodeTable[a.Op].argLen == 0 {
- key := vkey{a.Op, keyFor(a), a.Aux, typeStr(a)}
+ key := vkey{a.Op, keyFor(a), a.Aux, a.Type}
if rv, ok := vals[key]; ok {
v.SetArg(i, rv)
}
@@ -61,15 +61,7 @@ type vkey struct {
op Op
ai int64 // aux int
ax interface{} // aux
- t string // type
-}
-
-// typeStr returns a string version of the type of v.
-func typeStr(v *Value) string {
- if v.Type == nil {
- return ""
- }
- return v.Type.String()
+ t Type // type
}
// keyFor returns the AuxInt portion of a key structure uniquely identifying a