]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: improve escape analysis of known calls
authorMatthew Dempsky <mdempsky@google.com>
Tue, 22 Sep 2020 09:12:03 +0000 (02:12 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 15 Oct 2020 18:26:06 +0000 (18:26 +0000)
commitc0417df15664a84c3cc6de8292f78debce111def
treea108212a44ad9e938a2c6c22c71e30da3a998470
parentcced777026e1fc094ed21d99ae1efa4cf19146d2
cmd/compile: improve escape analysis of known calls

Escape analysis is currently very naive about identifying calls to
known functions: it only recognizes direct calls to a declared
function, or direct calls to a closure.

This CL adds a new "staticValue" helper function that can trace back
through local variables that were initialized and never reassigned
based on a similar optimization already used by inlining. (And to be
used by inlining in a followup CL.)

Updates #41474.

Change-Id: I8204fd3b1e150ab77a27f583985cf099a8572b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/256458
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/gc/inl.go
test/escape_closure.go