]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid implicit bounds checks after explicit checks for append
authorMartin Möhrmann <moehrmann@google.com>
Fri, 15 Jun 2018 23:22:07 +0000 (01:22 +0200)
committerMartin Möhrmann <moehrmann@google.com>
Mon, 15 Oct 2018 18:23:03 +0000 (18:23 +0000)
commit9f66b41beea82cc613cad9138c10a50f2b3ea137
tree79418af1891feb7b25952054d3ef04d284bc6f97
parentc9130cae9a9cd59178e842851f3f30b1d97ab0bd
cmd/compile: avoid implicit bounds checks after explicit checks for append

The generated code for the append builtin already checks if the appended
to slice is large enough and calls growslice if that is not the case.
Trust that this ensures the slice is large enough and avoid the
implicit bounds check when slicing the slice to its new size.

Removes 365 panicslice calls (-14%) from the go binary which
reduces the binary size by ~12kbyte.

Change-Id: I1b88418675ff409bc0b956853c9e95241274d5a6
Reviewed-on: https://go-review.googlesource.com/c/119315
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/walk.go