mirror of
https://github.com/golang/go
synced 2024-09-28 20:14:28 -06:00
cmd/compile: allow disable of PGO function value devirtualization with flag
Extend the pgodevirtualize debug flag to distinguish interface and function devirtualization. Setting 1 keeps interface devirtualization enabled but disables function value devirtualization. For #64209. Change-Id: I33aa7eb95ca0bdb215256d8c7cc8f9dac53ae30e Reviewed-on: https://go-review.googlesource.com/c/go/+/543115 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
3fd5c357a3
commit
1ab9df4849
@ -61,7 +61,7 @@ type DebugFlags struct {
|
||||
PGOInline int `help:"enable profile-guided inlining" concurrent:"ok"`
|
||||
PGOInlineCDFThreshold string `help:"cumulative threshold percentage for determining call sites as hot candidates for inlining" concurrent:"ok"`
|
||||
PGOInlineBudget int `help:"inline budget for hot functions" concurrent:"ok"`
|
||||
PGODevirtualize int `help:"enable profile-guided devirtualization" concurrent:"ok"`
|
||||
PGODevirtualize int `help:"enable profile-guided devirtualization; 0 to disable, 1 to enable interface devirtualization, 2 to enable function devirtualization" concurrent:"ok"`
|
||||
RangeFuncCheck int `help:"insert code to check behavior of range iterator functions" concurrent:"ok"`
|
||||
WrapGlobalMapDbg int `help:"debug trace output for global map init wrapping"`
|
||||
WrapGlobalMapCtl int `help:"global map init wrap control (0 => default, 1 => off, 2 => stress mode, no size cutoff)"`
|
||||
|
@ -179,7 +179,7 @@ func ParseFlags() {
|
||||
Debug.InlFuncsWithClosures = 1
|
||||
Debug.InlStaticInit = 1
|
||||
Debug.PGOInline = 1
|
||||
Debug.PGODevirtualize = 1
|
||||
Debug.PGODevirtualize = 2
|
||||
Debug.SyncFrames = -1 // disable sync markers by default
|
||||
Debug.ZeroCopy = 1
|
||||
Debug.RangeFuncCheck = 1
|
||||
|
@ -194,6 +194,10 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) {
|
||||
// ir.Node if call was devirtualized, and if so also the callee and weight of
|
||||
// the devirtualized edge.
|
||||
func maybeDevirtualizeInterfaceCall(p *pgo.Profile, fn *ir.Func, call *ir.CallExpr) (ir.Node, *ir.Func, int64) {
|
||||
if base.Debug.PGODevirtualize < 1 {
|
||||
return nil, nil, 0
|
||||
}
|
||||
|
||||
// Bail if we do not have a hot callee.
|
||||
callee, weight := findHotConcreteInterfaceCallee(p, fn, call)
|
||||
if callee == nil {
|
||||
@ -220,6 +224,10 @@ func maybeDevirtualizeInterfaceCall(p *pgo.Profile, fn *ir.Func, call *ir.CallEx
|
||||
// ir.Node if call was devirtualized, and if so also the callee and weight of
|
||||
// the devirtualized edge.
|
||||
func maybeDevirtualizeFunctionCall(p *pgo.Profile, fn *ir.Func, call *ir.CallExpr) (ir.Node, *ir.Func, int64) {
|
||||
if base.Debug.PGODevirtualize < 2 {
|
||||
return nil, nil, 0
|
||||
}
|
||||
|
||||
// Bail if this is a direct call; no devirtualization necessary.
|
||||
callee := pgo.DirectCallee(call.Fun)
|
||||
if callee != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user