]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: don’t consider recursive calls for inlining
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 5 May 2016 18:45:27 +0000 (11:45 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sun, 21 Aug 2016 23:18:50 +0000 (23:18 +0000)
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>

src/cmd/compile/internal/gc/main.go

index b21daf5ff27197dcc1ba4f257f5aa6b5297f6a28..eeadc7e73ed57bc864896f403c27a7fd37663b29 100644 (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)
                        }
                })
        }