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.

Index: gcc/testsuite/go.test/test/nilptr2.go
===================================================================
--- gcc/testsuite/go.test/test/nilptr2.go	(revision 271105)
+++ gcc/testsuite/go.test/test/nilptr2.go	(working copy)
@@ -35,7 +35,10 @@
 var m1 *M1
 var m2 *M2

-func use(interface{}) {
+var V interface{}
+
+func use(x interface{}) {
+	V = x
 }

 var tests = []struct{

Change-Id: I4577a863ac893670af44f862a289cbb00cb2479c
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/176459
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 files changed