go/src
Ilya Tocar 9916feeddf cmd/compile/internal/ssa: don't spill register offsets on amd64
Transform (ADDQconst SP) into (LEA SP), because lea is rematerializeable,
so this avoids register spill. We can't mark ADDQconst as rematerializeable,
because it clobbers flags. This makes go binary ~2kb smaller.

For reference here is generated code for function from bug report.
Before:
        CALL    "".g(SB)
        MOVBLZX (SP), AX
        LEAQ    8(SP), DI
        TESTB   AX, AX
        JEQ     15
        MOVQ    "".p(SP), SI
        DUFFCOPY        $196
        MOVQ    $0, (SP)
        PCDATA  $0, $1
        CALL    "".h(SB)
        RET
        MOVQ    DI, ""..autotmp_2-8(SP) // extra spill
        PCDATA  $0, $2
        CALL    "".g(SB)
        MOVQ    ""..autotmp_2-8(SP), DI // extra register fill
        MOVQ    "".p(SP), SI
        DUFFCOPY        $196
        MOVQ    $1, (SP)
        PCDATA  $0, $1
        CALL    "".h(SB)
        JMP     14
        END

After:
        CALL    "".g(SB)
        MOVBLZX (SP), AX
        TESTB   AX, AX
        JEQ     15
        LEAQ    8(SP), DI
        MOVQ    "".p(SP), SI
        DUFFCOPY        $196
        MOVQ    $0, (SP)
        PCDATA  $0, $1
        CALL    "".h(SB)
        RET
        PCDATA  $0, $0  // no spill
        CALL    "".g(SB)
        LEAQ    8(SP), DI // rematerialized instead
        MOVQ    "".p(SP), SI
        DUFFCOPY        $196
        MOVQ    $1, (SP)
        PCDATA  $0, $1
        CALL    "".h(SB)
        JMP     14
        END

Fixes #22947

Change-Id: I8f33b860dc6c8828373477171b172ca2ce30074f
Reviewed-on: https://go-review.googlesource.com/81815
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-02-14 20:08:43 +00:00
..
archive archive/tar: automatically promote TypeRegA 2018-02-13 18:36:49 +00:00
bufio bufio: Use maxConsecutiveEmptyReads instead of 100 2017-11-14 05:21:00 +00:00
builtin builtin: improve docs for make slice 2017-11-18 01:48:52 +00:00
bytes bytes: mention strings.Builder in Buffer.String docs 2017-11-30 01:46:50 +00:00
cmd cmd/compile/internal/ssa: don't spill register offsets on amd64 2018-02-14 20:08:43 +00:00
compress
container container/list: document nil values more 2018-01-08 18:06:27 +00:00
context
crypto crypto/cipher: add NewGCMWithNonceAndTagSize for custom tag sizes. 2018-02-14 15:32:26 +00:00
database/sql database/sql: remove duplicate validation 2018-02-13 21:25:13 +00:00
debug debug/gosym: update docs for changes in Go 1.3 2017-11-30 22:49:27 +00:00
encoding encoding/hex: fix potential incorrect Dumper output when Close is called multiple times 2018-02-14 03:25:25 +00:00
errors
expvar
flag flag: clarify comment to avoid shell syntax confusion 2017-12-06 04:36:03 +00:00
fmt fmt: hide bad format in test from vet 2017-10-31 13:49:53 +00:00
go go/build: add go1.11 build tag 2018-02-13 23:36:06 +00:00
hash hash: add MarshalBinary/UnmarshalBinary round trip + golden test for all implementations 2017-12-06 07:45:46 +00:00
html html/template: check for duplicates when inserting escapers 2018-01-10 17:36:27 +00:00
image image/gif: support non-looping animated gifs (LoopCount=-1) 2018-02-13 20:25:49 +00:00
index/suffixarray
internal internal/cpu: make arm64 capability bits naming less verbose 2018-02-14 09:25:34 +00:00
io io: eliminate full copy of copy loop in CopyN 2017-11-16 02:24:37 +00:00
log
math math/big: fix %s verbs in Float tests error messages 2018-02-14 09:50:19 +00:00
mime all: unindent some if bodies by exiting early 2017-10-31 20:07:46 +00:00
net net/http: add StatusMisdirectedRequest (421) 2018-02-13 18:38:49 +00:00
os syscall, os: use pipe2 syscall on NetBSD instead of pipe 2018-02-14 15:51:46 +00:00
path path/filepath: fix escaped chars in Glob on non-Windows 2018-02-14 11:47:59 +00:00
plugin plugin: document support for macOS 2017-12-12 00:59:50 +00:00
reflect reflect: add embedded field test 2018-02-14 15:28:25 +00:00
regexp regexp: don't allocate when All methods find no matches 2018-02-13 18:44:40 +00:00
runtime runtime: use private futexes on Linux 2018-02-14 17:37:26 +00:00
sort
strconv strconv: detect invalid UTF-8 in the Unquote fast path 2018-02-13 18:33:44 +00:00
strings strings: prevent copyCheck from forcing Builder to escape and allocate 2018-01-09 22:01:28 +00:00
sync sync: enable profiling of RWMutex 2018-02-14 15:38:42 +00:00
syscall syscall, os: use pipe2 syscall on NetBSD instead of pipe 2018-02-14 15:51:46 +00:00
testing cmd/go, testing: test names don't have to be alphanumeric 2018-01-04 01:52:55 +00:00
text text/template: never call reflect.Zero(nil) 2018-02-13 22:18:21 +00:00
time time: add example for FixedZone 2018-02-13 21:57:23 +00:00
unicode Revert "go/printer: forbid empty line before first comment in block" 2017-12-01 01:12:26 +00:00
unsafe
vendor/golang_org/x vendor: update golang.org/x/net/nettest from upstream 2017-11-29 19:55:02 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash misc,src: add support for specifying adb flags to the android harness 2018-01-20 21:13:30 +00:00
bootstrap.bash bootstrap.bash: only fetch git revision if we need it 2018-01-30 15:11:56 +00:00
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash cmd/dist: fix bad LC_TIME assumption in 'date' invocation 2017-11-03 13:42:33 +00:00
make.bat build: quiet make.bash, make.bat, make.rc 2017-10-31 13:48:53 +00:00
make.rc build: quiet make.bash, make.bat, make.rc 2017-10-31 13:48:53 +00:00
naclmake.bash nacl*.bash: pass flags to make.bash 2018-02-14 17:09:31 +00:00
nacltest.bash nacl*.bash: pass flags to make.bash 2018-02-14 17:09:31 +00:00
race.bash
race.bat
run.bash
run.bat
run.rc