Commit 0df81e88 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: simplify and clean up inlnode

Change-Id: I0d14d68b57e8605cdae8a45d6fa97255a42297d8
Reviewed-on: https://go-review.googlesource.com/37521
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 566e72d0
......@@ -405,7 +405,7 @@ func inlnode(n *Node) *Node {
case OCALLFUNC, OCALLMETH:
n.Left.setNoInline(true)
}
fallthrough
return n
// TODO do them here (or earlier),
// so escape analysis can avoid more heapmoves.
......@@ -445,14 +445,9 @@ func inlnode(n *Node) *Node {
}
}
// if we just replaced arg in f(arg()) or return arg with an inlined call
// and arg returns multiple values, glue as list
case ORETURN,
OCALLFUNC,
OCALLMETH,
OCALLINTER,
OAPPEND,
OCOMPLEX:
case ORETURN, OCALLFUNC, OCALLMETH, OCALLINTER, OAPPEND, OCOMPLEX:
// if we just replaced arg in f(arg()) or return arg with an inlined call
// and arg returns multiple values, glue as list
if n.List.Len() == 1 && n.List.First().Op == OINLCALL && n.List.First().Rlist.Len() > 1 {
n.List.Set(inlconv2list(n.List.First()))
break
......@@ -469,18 +464,12 @@ func inlnode(n *Node) *Node {
}
inlnodelist(n.Rlist)
switch n.Op {
case OAS2FUNC:
if n.Rlist.First().Op == OINLCALL {
n.Rlist.Set(inlconv2list(n.Rlist.First()))
n.Op = OAS2
n.Typecheck = 0
n = typecheck(n, Etop)
break
}
fallthrough
default:
if n.Op == OAS2FUNC && n.Rlist.First().Op == OINLCALL {
n.Rlist.Set(inlconv2list(n.Rlist.First()))
n.Op = OAS2
n.Typecheck = 0
n = typecheck(n, Etop)
} else {
s := n.Rlist.Slice()
for i1, n1 := range s {
if n1.Op == OINLCALL {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment