cmd/compile: adjust PGO debug output slightly

- Include the callee names in hot call inlining message.
- Print the graph when pgoinline >= 2.

Change-Id: Iceb89b5f18cefc69ab9256aca9a910743d22ec0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/448496
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Cherry Mui 2022-11-07 17:05:33 -05:00
parent efe541d4e5
commit e5d2814576

View file

@ -122,7 +122,7 @@ func pgoInlinePrologue(p *pgo.Profile) {
} }
} }
}) })
if base.Debug.PGOInline > 0 { if base.Debug.PGOInline >= 2 {
fmt.Printf("hot-cg before inline in dot format:") fmt.Printf("hot-cg before inline in dot format:")
p.PrintWeightedCallGraphDOT(inlineHotCallSiteThresholdPercent) p.PrintWeightedCallGraphDOT(inlineHotCallSiteThresholdPercent)
} }
@ -165,7 +165,7 @@ func computeThresholdFromCDF(p *pgo.Profile) (float64, []pgo.NodeMapKey) {
// pgoInlineEpilogue updates IRGraph after inlining. // pgoInlineEpilogue updates IRGraph after inlining.
func pgoInlineEpilogue(p *pgo.Profile) { func pgoInlineEpilogue(p *pgo.Profile) {
if base.Debug.PGOInline > 0 { if base.Debug.PGOInline >= 2 {
ir.VisitFuncsBottomUp(typecheck.Target.Decls, func(list []*ir.Func, recursive bool) { ir.VisitFuncsBottomUp(typecheck.Target.Decls, func(list []*ir.Func, recursive bool) {
for _, f := range list { for _, f := range list {
name := ir.PkgFuncName(f) name := ir.PkgFuncName(f)
@ -930,7 +930,7 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlCalls *[]*ir.Inlin
return n return n
} }
if base.Debug.PGOInline > 0 { if base.Debug.PGOInline > 0 {
fmt.Printf("hot-budget check allows inlining for callsite at %v\n", ir.Line(n)) fmt.Printf("hot-budget check allows inlining for call %s at %v\n", ir.PkgFuncName(fn), ir.Line(n))
} }
} else { } else {
// The inlined function body is too big. Typically we use this check to restrict // The inlined function body is too big. Typically we use this check to restrict