]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: deal with call.Use correctly for noder2, allow inlining of stenciled...
authorDan Scales <danscales@google.com>
Tue, 30 Mar 2021 23:03:26 +0000 (16:03 -0700)
committerDan Scales <danscales@google.com>
Wed, 31 Mar 2021 00:52:58 +0000 (00:52 +0000)
commit6d2a557a4d09b6f60e2522fb740b5d7d1d8dc8e2
tree19796914f268ea5a4f6a77d83f668c2eddb926e7
parentf2717b31b5cf235457631fea1afd6d9df578737c
cmd/compile: deal with call.Use correctly for noder2, allow inlining of stenciled functions

The setting of n.Use for a call node in transformCall() (and previously
in Call()), was not corrrect, since it was trying to use the number of
results of the call, rather than whether the call result was actually
used. We are already setting n.Use to ir.CallUseStmt if the call node is
directly a statement, so we just need to initialize n.Use to
ir.CallExprStmt in Call(), which will get changed to ir.CallUseStmt at
the statement level if it's used as a statement.

Enable inlining of stenciled functions (just disabled for testing,
easier debugging). The above n.Use fix was required for the inlining
to work for two cases.

Change-Id: Ie4ef6cd53fd4b20a4f3be31e629280909a545b7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/305913
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/noder/helpers.go
src/cmd/compile/internal/noder/stencil.go
src/cmd/compile/internal/noder/transform.go