compiler: improve escape analysis on interface conversions
authorCherry Zhang <cherryyz@google.com>
Thu, 16 May 2019 04:35:15 +0000 (04:35 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 16 May 2019 04:35:15 +0000 (04:35 +0000)
commite8e91b845496603168161015ccd5325524abbf7e
tree042ec42badf35137c4249ed7ab62797a8a50cf48
parent92b8603c7c6789806879307a29ae3b85adaaaf14
compiler: improve escape analysis on interface conversions

    If an interface does not escape, it doesn't need a heap
    allocation to hold the data (for non-direct interface type).
    This CL improves the escape analysis to track interface
    conversions, and reduces these allocations.

    Implicit interface conversions were mostly added late in the
    compilation pipeline, after the escape analysis. For the escape
    analysis to see them, we move the introduction of these
    conversions earlier, right before the escape analysis.

    Now that the compiler can generate interface conversions inlined,
    gcc/testsuite/go.test/test/nilptr2.go needs to be adjusted as in
    golang.org/cl/176579, so the use function does an actual use.

    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/176459

* go.test/test/nilptr2.go: Change use function to actually do
something.

From-SVN: r271276
gcc/go/gofrontend/MERGE
gcc/go/gofrontend/escape.cc
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/expressions.h
gcc/go/gofrontend/go.cc
gcc/go/gofrontend/gogo.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/statements.cc
gcc/go/gofrontend/statements.h
gcc/testsuite/ChangeLog
gcc/testsuite/go.test/test/nilptr2.go