]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: report more non-inlineable functions
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 9 Nov 2016 06:18:38 +0000 (22:18 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Wed, 1 Feb 2017 20:34:34 +0000 (20:34 +0000)
Many non-inlineable functions were not being
reported in '-m -m' mode.

Updates #17858.

Change-Id: I7d96361b39dd317f5550e57334a8a6dd1a836598
Reviewed-on: https://go-review.googlesource.com/32971
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/inl.go

index 9912cf5aa04fcdc89345edf0acaa467be37fa820..709578241192ff6acf3c7b04dd5ae3184ba683fa 100644 (file)
@@ -268,7 +268,12 @@ func ishairy(n *Node, budget *int32, reason *string) bool {
                *budget -= 2
        }
 
-       return *budget < 0 || ishairy(n.Left, budget, reason) || ishairy(n.Right, budget, reason) ||
+       if *budget < 0 {
+               *reason = "function too complex"
+               return true
+       }
+
+       return ishairy(n.Left, budget, reason) || ishairy(n.Right, budget, reason) ||
                ishairylist(n.List, budget, reason) || ishairylist(n.Rlist, budget, reason) ||
                ishairylist(n.Ninit, budget, reason) || ishairylist(n.Nbody, budget, reason)
 }