]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: enable CSE of constant strings
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 31 Aug 2016 02:11:19 +0000 (19:11 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 20 Mar 2017 20:22:26 +0000 (20:22 +0000)
commite22ba7f0fbd7a92418834dafbc1b539de1a85219
treed0b25feb1c6a137d8dec6c56f85765cf021c3337
parent25b51810014cefb8dba31321fcf40eb1a008fc3e
cmd/compile: enable CSE of constant strings

CL 27254 changed a constant string to a byte array
in encoding/hex and got significant performance
improvements.

hex.Encode used the string twice in a single function.
The rewrite rules lower constant strings into components.
The pointer component requires an aux symbol.
The existing implementation created a new aux symbol every time.
As a result, constant string pointers were never CSE'd.
Tighten then moved the pointer calculation next to the uses, i.e.
into the loop.

The re-use of aux syms enabled by this CL
occurs 3691 times during make.bash.

This CL should not go in without CL 38338
or something like it.

Change-Id: Ibbf5b17283c0e31821d04c7e08d995c654de5663
Reviewed-on: https://go-review.googlesource.com/28219
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go