1
0
mirror of https://github.com/golang/go synced 2024-10-02 12:18:33 -06:00
go/src
Michael Munday 58cdecb9c8 cmd/compile: generate constants for NeqPtr, EqPtr and IsNonNil ops
If both inputs are constant offsets from the same pointer then we
can evaluate NeqPtr and EqPtr at compile time. Triggers a few times
during all.bash. Removes a conditional branch in the following
code:

copy(x[1:], x[:])

This branch was recently added as an optimization in CL 94596. We
now skip the memmove if the pointers are equal. However, in the
above code we know at compile time that they are never equal.

Also, when the offset is variable, check if the offset is zero
rather than if the pointers are equal. For example:

copy(x[a:], x[:])

This would now skip the copy if a == 0, rather than if x + a == x.

Finally I've also added a rule to make IsNonNil true for pointers
to values on the stack. The nil check elimination pass will catch
these anyway, but eliminating them here might eliminate branches
earlier.

Change-Id: If72f436fef0a96ad0f4e296d3a1f8b6c3e712085
Reviewed-on: https://go-review.googlesource.com/106635
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2018-04-16 20:43:57 +00:00
..
archive go/printer, gofmt: tuned table alignment for better results 2018-04-04 13:39:34 -07:00
bufio bufio: document ReadFrom/WriteTo calls to underlying methods 2018-03-28 22:21:52 +00:00
builtin
bytes internal/bytealg: move short string Index implementations into bytealg 2018-03-04 19:49:44 +00:00
cmd cmd/compile: generate constants for NeqPtr, EqPtr and IsNonNil ops 2018-04-16 20:43:57 +00:00
compress compress/gzip: do not count header bytes written in Write 2018-04-02 20:18:14 +00:00
container container/heap: fix comments style 2018-04-11 20:11:09 +00:00
context context: avoid defer in the cancelCtx.Err method 2018-04-15 21:35:53 +00:00
crypto crypto/x509: don't return nil, nil from SystemCertPool 2018-04-13 00:52:47 +00:00
database/sql database/sql: remove a couple redundancies 2018-04-12 19:23:46 +00:00
debug debug/gosym: intern LineTable strings 2018-04-13 19:52:07 +00:00
encoding encoding/xml: remove unnecessary if conditions 2018-04-15 16:40:39 +00:00
errors
expvar all: use strings.Builder instead of bytes.Buffer where appropriate 2018-03-26 23:05:53 +00:00
flag flag: correct zero values when printing defaults 2018-04-01 20:17:22 +00:00
fmt fmt: document the behaviour of %p on slices 2018-03-30 00:19:36 +00:00
go net/http: omit forbidden Trailer headers from response 2018-04-16 17:44:41 +00:00
hash crypto: remove hand encoded amd64 instructions 2018-03-01 19:20:53 +00:00
html text/template: copy Decl field when copying PipeNode 2018-04-10 14:26:58 +00:00
image all: fix non-standard "DO NOT EDIT" comments for generated files 2018-03-10 17:50:11 +00:00
index/suffixarray
internal net: implement (*syscall.RawConn).Read/Write on Windows 2018-04-14 05:36:36 +00:00
io io/ioutil: change TempFile prefix to a pattern 2018-04-12 20:00:25 +00:00
log
math all: use new softfloat on GOARM=5 2018-04-13 16:39:39 +00:00
mime mime: add wasm architecture 2018-04-13 20:20:12 +00:00
net net/http: omit forbidden Trailer headers from response 2018-04-16 17:44:41 +00:00
os cmd/dist, os/user: test os/user in osusergo mode as well, fix plan9 & windows 2018-04-16 19:38:57 +00:00
path path/filepath: change example to print the correct path on failure 2018-03-26 17:40:01 +00:00
plugin
reflect reflect: sort exported methods first 2018-03-15 21:56:08 +00:00
regexp regexp: use sync.Pool to cache regexp.machine objects 2018-04-03 16:03:19 +00:00
runtime runtime: use internal/cpu.X86.HasAVX2 instead of support_avx2 2018-04-15 20:33:59 +00:00
sort sort: fix typo, was a mixup between identifiers 'unsorted' and 'data' 2018-03-19 13:09:29 +00:00
strconv strconv: make code formatting more consistent in doc.go 2018-03-19 12:53:16 +00:00
strings strings: fix flaky TestBuilderGrow test 2018-04-03 00:11:46 +00:00
sync cmd/internal/obj/arm: add DMB instruction 2018-03-27 19:54:44 +00:00
syscall syscall: remove WSAEMSGSIZE 2018-04-14 03:52:37 +00:00
testing testing: fix testing flags link 2018-03-30 23:34:47 +00:00
text text/tabwriter: reduce allocations from tracking cells 2018-04-14 14:41:50 +00:00
time time: go fmt 2018-04-16 15:26:44 +00:00
unicode
unsafe unsafe: fix reference to string header 2018-02-26 18:35:46 +00:00
vendor/golang_org/x net/http: omit forbidden Trailer headers from response 2018-04-16 17:44:41 +00:00
all.bash
all.bat
all.rc
androidtest.bash androidtest.bash: don't require GOARCH set 2018-03-07 14:01:43 +00:00
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash iostest.bash: don't build std library twice 2018-03-06 16:08:20 +00:00
make.bash
make.bat build: small cleanup in error message in make.bat 2018-02-26 10:27:14 +00:00
Make.dist
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash src/run.bash: remove some trailing whitespace 2018-04-01 16:12:47 +00:00
run.bat
run.rc