cmd/compile: don’t consider recursive calls for inlining

We will never inline recursive calls.
Rather than simulate the recursion until we hit
the complexity ceiling, just bail early.

Also, remove a pointless n.Op check.
visitBottomUp guarantees that n will be an
ODCLFUNC, and caninl double-checks it.

Change-Id: Ifa48331686b24289d34e68cf5bef385f464b6b92
Reviewed-on: https://go-review.googlesource.com/27462
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2016-05-05 11:45:27 -07:00
parent d1faf3879e
commit 376d9665a8

View File

@ -438,10 +438,10 @@ func Main() {
// Find functions that can be inlined and clone them before walk expands them.
visitBottomUp(xtop, func(list []*Node, recursive bool) {
for _, n := range list {
if n.Op == ODCLFUNC {
if !recursive {
caninl(n)
inlcalls(n)
}
inlcalls(n)
}
})
}