mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
This patch changes the relative order of "CanInline" and "InlineCalls" operations within the inliner for clumps of functions corresponding to strongly connected components in the call graph. This helps increase the amount of inlining within SCCs, particularly in Go's runtime package, which has a couple of very large SCCs. For a given SCC of the form { fn1, fn2, ... fnk }, the inliner would (prior to this point) walk through the list of functions and for each function first compute inlinability ("CanInline") and then perform inlining ("InlineCalls"). This meant that if there was an inlinable call from fn3 to fn4 (for example), this call would never be inlined, since at the point fn3 was visited, we would not have computed inlinability for fn4. We now do inlinability analysis for all functions in an SCC first, then do actual inlining for everything. This results in 47 additional inlines in the Go runtime package (a fairly modest increase percentage-wise of 0.6%). Updates #58905. Change-Id: I48dbb1ca16f0b12f256d9eeba8cf7f3e6dd853cd Reviewed-on: https://go-review.googlesource.com/c/go/+/474955 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
67 lines
4.7 KiB
Go
67 lines
4.7 KiB
Go
// Copyright 2009 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Debug arguments, set by -d flag.
|
|
|
|
package base
|
|
|
|
// Debug holds the parsed debugging configuration values.
|
|
var Debug DebugFlags
|
|
|
|
// DebugFlags defines the debugging configuration values (see var Debug).
|
|
// Each struct field is a different value, named for the lower-case of the field name.
|
|
// Each field must be an int or string and must have a `help` struct tag.
|
|
//
|
|
// The -d option takes a comma-separated list of settings.
|
|
// Each setting is name=value; for ints, name is short for name=1.
|
|
type DebugFlags struct {
|
|
Append int `help:"print information about append compilation"`
|
|
Checkptr int `help:"instrument unsafe pointer conversions\n0: instrumentation disabled\n1: conversions involving unsafe.Pointer are instrumented\n2: conversions to unsafe.Pointer force heap allocation" concurrent:"ok"`
|
|
Closure int `help:"print information about closure compilation"`
|
|
Defer int `help:"print information about defer compilation"`
|
|
DisableNil int `help:"disable nil checks" concurrent:"ok"`
|
|
DumpPtrs int `help:"show Node pointers values in dump output"`
|
|
DwarfInl int `help:"print information about DWARF inlined function creation"`
|
|
Export int `help:"print export data"`
|
|
Fmahash string `help:"hash value for use in debugging platform-dependent multiply-add use" concurrent:"ok"`
|
|
GCAdjust int `help:"log adjustments to GOGC" concurrent:"ok"`
|
|
GCCheck int `help:"check heap/gc use by compiler" concurrent:"ok"`
|
|
GCProg int `help:"print dump of GC programs"`
|
|
Gossahash string `help:"hash value for use in debugging the compiler"`
|
|
InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"`
|
|
InlStaticInit int `help:"allow static initialization of inlined calls" concurrent:"ok"`
|
|
InterfaceCycles int `help:"allow anonymous interface cycles"`
|
|
InlineSCCOnePass int `help:"visit SCC funcs only once during inlining (legacy behavior)"`
|
|
Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
|
|
LoopVar int `help:"shared (0, default), 1 (private loop variables), 2, private + log"`
|
|
LoopVarHash string `help:"for debugging changes in loop behavior. Overrides experiment and loopvar flag."`
|
|
LocationLists int `help:"print information about DWARF location list creation"`
|
|
Nil int `help:"print information about nil checks"`
|
|
NoOpenDefer int `help:"disable open-coded defers" concurrent:"ok"`
|
|
NoRefName int `help:"do not include referenced symbol names in object file" concurrent:"ok"`
|
|
PCTab string `help:"print named pc-value table\nOne of: pctospadj, pctofile, pctoline, pctoinline, pctopcdata"`
|
|
Panic int `help:"show all compiler panics"`
|
|
Reshape int `help:"print information about expression reshaping"`
|
|
Shapify int `help:"print information about shaping recursive types"`
|
|
Slice int `help:"print information about slice compilation"`
|
|
SoftFloat int `help:"force compiler to emit soft-float code" concurrent:"ok"`
|
|
SyncFrames int `help:"how many writer stack frames to include at sync points in unified export data"`
|
|
TypeAssert int `help:"print information about type assertion inlining"`
|
|
WB int `help:"print information about write barriers"`
|
|
ABIWrap int `help:"print information about ABI wrapper generation"`
|
|
MayMoreStack string `help:"call named function before all stack growth checks" 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"`
|
|
PGOInline int `help:"debug profile-guided inlining"`
|
|
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)"`
|
|
|
|
ConcurrentOk bool // true if only concurrentOk flags seen
|
|
}
|
|
|
|
// DebugSSA is called to set a -d ssa/... option.
|
|
// If nil, those options are reported as invalid options.
|
|
// If DebugSSA returns a non-empty string, that text is reported as a compiler error.
|
|
var DebugSSA func(phase, flag string, val int, valString string) string
|