test: add regress test for #27557

This commit just adds a regress test for a few of the important corner
cases that I identified in #27557, which turn out to not be tested
anywhere.

While here, annotate a few of the existing test cases where we could
improve escape analysis.

Updates #27557.

Change-Id: Ie57792a538f7899bb17915485fabc86100f469a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/197137
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
Matthew Dempsky 2019-09-24 17:35:15 -07:00
parent 8189a06190
commit f346a4c44c
5 changed files with 47 additions and 4 deletions

View file

@ -505,10 +505,7 @@ func (e *Escape) exprSkipInit(k EscHole, n *Node) {
case OCALLPART:
e.spill(k, n)
// esc.go says "Contents make it to memory, lose
// track." I think we can just flow n.Left to our
// spilled location though.
// TODO(mdempsky): Try that.
// TODO(mdempsky): We can do better here. See #27557.
e.assignHeap(n.Left, "call part", n)
case OPTRLIT: