Commit 475df0eb authored by Ilya Tocar's avatar Ilya Tocar

cmd/compile/internal/gc: better inliner diagnostics

When debugging inliner with -m -m print cost of complex functions,
instead of simple "function too complex". This helps to understand,
how close to inlining is this particular function.

Change-Id: I6871f69b5b914d23fd0b43a24d7c6fc928f4b716
Reviewed-on: https://go-review.googlesource.com/63330
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 8e5ac83d
...@@ -157,7 +157,7 @@ func caninl(fn *Node) { ...@@ -157,7 +157,7 @@ func caninl(fn *Node) {
return return
} }
if visitor.budget < 0 { if visitor.budget < 0 {
reason = "function too complex" reason = fmt.Sprintf("function too complex: cost %d exceeds budget %d", maxBudget-visitor.budget, maxBudget)
return return
} }
...@@ -297,8 +297,8 @@ func (v *hairyVisitor) visit(n *Node) bool { ...@@ -297,8 +297,8 @@ func (v *hairyVisitor) visit(n *Node) bool {
v.budget -= 2 v.budget -= 2
} }
if v.budget < 0 { // When debugging, don't stop early, to get full cost of inlining this function
v.reason = "function too complex" if v.budget < 0 && Debug['m'] < 2 {
return true return true
} }
......
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