mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
f2717b31b5
commit
6d2a557a4d
3 changed files with 3 additions and 7 deletions
|
|
@ -143,11 +143,6 @@ func transformCall(n *ir.CallExpr) {
|
|||
}
|
||||
|
||||
typecheckaste(ir.OCALL, n.X, n.IsDDD, t.Params(), n.Args)
|
||||
if t.NumResults() == 0 {
|
||||
n.Use = ir.CallUseStmt
|
||||
return
|
||||
}
|
||||
n.Use = ir.CallUseExpr
|
||||
if t.NumResults() == 1 {
|
||||
n.SetType(l.Type().Results().Field(0).Type)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue