From: Ilya Tocar Date: Tue, 12 Sep 2017 18:53:55 +0000 (-0500) Subject: cmd/compile/internal/gc: better inliner diagnostics X-Git-Tag: go1.10beta1~1040 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=475df0ebccaf0871c86b2c0b55ee841aede324b7;p=gostls13.git 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 Reviewed-by: Matthew Dempsky TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/compile/internal/gc/inl.go b/src/cmd/compile/internal/gc/inl.go index 3a34ab9246..35da0de6dd 100644 --- a/src/cmd/compile/internal/gc/inl.go +++ b/src/cmd/compile/internal/gc/inl.go @@ -157,7 +157,7 @@ func caninl(fn *Node) { return } if visitor.budget < 0 { - reason = "function too complex" + reason = fmt.Sprintf("function too complex: cost %d exceeds budget %d", maxBudget-visitor.budget, maxBudget) return } @@ -297,8 +297,8 @@ func (v *hairyVisitor) visit(n *Node) bool { v.budget -= 2 } - if v.budget < 0 { - v.reason = "function too complex" + // When debugging, don't stop early, to get full cost of inlining this function + if v.budget < 0 && Debug['m'] < 2 { return true }