diff options
| author | Michael Pratt <mpratt@google.com> | 2023-11-16 13:00:55 -0500 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2023-11-16 21:31:12 +0000 |
| commit | 1ab9df4849d1bb527035ccf475cc5b7b4aa9b789 (patch) | |
| tree | 749b7c5c1f614efd19ed000d2eb4dc5790ad88ea /src/cmd/compile/internal/devirtualize | |
| parent | 3fd5c357a3a763f70f3ed684caed878e732e6ebe (diff) | |
| download | go-1ab9df4849d1bb527035ccf475cc5b7b4aa9b789.tar.xz | |
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>
Diffstat (limited to 'src/cmd/compile/internal/devirtualize')
| -rw-r--r-- | src/cmd/compile/internal/devirtualize/pgo.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/devirtualize/pgo.go b/src/cmd/compile/internal/devirtualize/pgo.go index 7b6c8ba0c0..05b37d6be6 100644 --- a/src/cmd/compile/internal/devirtualize/pgo.go +++ b/src/cmd/compile/internal/devirtualize/pgo.go @@ -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 { |
