diff options
| author | David Chase <drchase@google.com> | 2019-10-09 18:06:06 -0400 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2019-10-15 16:43:44 +0000 |
| commit | 6adaf17eaaa7f2a8ec59a01f5b7280db210b3e75 (patch) | |
| tree | 220e516cae1a828049f9234b9e99cd16ff88760a /test/codegen | |
| parent | c2c2ba280c77e76115cf1918d91a509f6bf98390 (diff) | |
| download | go-6adaf17eaaa7f2a8ec59a01f5b7280db210b3e75.tar.xz | |
cmd/compile: preserve statements in late nilcheckelim optimization
When a subsequent load/store of a ptr makes the nil check of that pointer
unnecessary, if their lines differ, change the line of the load/store
to that of the nilcheck, and attempt to rehome the load/store position
instead.
This fix makes profiling less accurate in order to make panics more
informative.
Fixes #33724
Change-Id: Ib9afaac12fe0d0320aea1bf493617facc34034b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/200197
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/memcombine.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go index d5f3af7692..e2d703cb0c 100644 --- a/test/codegen/memcombine.go +++ b/test/codegen/memcombine.go @@ -321,8 +321,8 @@ func fcall_uint32(a, b uint32) (uint32, uint32) { // We want to merge load+op in the first function, but not in the // second. See Issue 19595. func load_op_merge(p, q *int) { - x := *p - *q += x // amd64:`ADDQ\t\(` + x := *p // amd64:`ADDQ\t\(` + *q += x // The combined nilcheck and load would normally have this line number, but we want that combined operation to have the line number of the nil check instead (see #33724). } func load_op_no_merge(p, q *int) { x := *p |
