From 6076edc55c548878c261316f3e3294f1f73125a3 Mon Sep 17 00:00:00 2001 From: Jun10ng Date: Mon, 5 Feb 2024 17:12:17 +0000 Subject: [PATCH] cmd/compile: delete unused code and fix typo in comment Change-Id: Ia1f1c7d5563a74950c47cf3ebdcb600b34c83e85 GitHub-Last-Rev: bd58214e5e66e32c0055936820b8f0adf7f388c6 GitHub-Pull-Request: golang/go#65527 Reviewed-on: https://go-review.googlesource.com/c/go/+/561355 Auto-Submit: Matthew Dempsky Run-TryBot: Robert Griesemer Reviewed-by: Robert Griesemer Reviewed-by: Matthew Dempsky TryBot-Result: Gopher Robot --- src/cmd/compile/internal/inline/inl.go | 17 ++++++++--------- .../compile/internal/inline/inlheur/analyze.go | 2 +- .../compile/internal/inline/inlheur/scoring.go | 6 +++--- .../internal/inline/interleaved/interleaved.go | 2 +- src/internal/profile/graph.go | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index f6f6ad8411..3e4c39ed9c 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -78,7 +78,7 @@ var ( ) // PGOInlinePrologue records the hot callsites from ir-graph. -func PGOInlinePrologue(p *pgo.Profile, funcs []*ir.Func) { +func PGOInlinePrologue(p *pgo.Profile) { if base.Debug.PGOInlineCDFThreshold != "" { if s, err := strconv.ParseFloat(base.Debug.PGOInlineCDFThreshold, 64); err == nil && s >= 0 && s <= 100 { inlineCDFHotCallSiteThresholdPercent = s @@ -119,7 +119,7 @@ func PGOInlinePrologue(p *pgo.Profile, funcs []*ir.Func) { // a percent, is the lower bound of weight for nodes to be considered hot // (currently only used in debug prints) (in case of equal weights, // comparing with the threshold may not accurately reflect which nodes are -// considiered hot). +// considered hot). func hotNodesFromCDF(p *pgo.Profile) (float64, []pgo.NamedCallEdge) { cum := int64(0) for i, n := range p.NamedEdgeMap.ByWeight { @@ -138,7 +138,7 @@ func hotNodesFromCDF(p *pgo.Profile) (float64, []pgo.NamedCallEdge) { // CanInlineFuncs computes whether a batch of functions are inlinable. func CanInlineFuncs(funcs []*ir.Func, profile *pgo.Profile) { if profile != nil { - PGOInlinePrologue(profile, funcs) + PGOInlinePrologue(profile) } ir.VisitFuncsBottomUp(funcs, func(list []*ir.Func, recursive bool) { @@ -227,7 +227,7 @@ func GarbageCollectUnreferencedHiddenClosures() { } // inlineBudget determines the max budget for function 'fn' prior to -// analyzing the hairyness of the body of 'fn'. We pass in the pgo +// analyzing the hairiness of the body of 'fn'. We pass in the pgo // profile if available (which can change the budget), also a // 'relaxed' flag, which expands the budget slightly to allow for the // possibility that a call to the function might have its score @@ -239,7 +239,7 @@ func inlineBudget(fn *ir.Func, profile *pgo.Profile, relaxed bool, verbose bool) if profile != nil { if n, ok := profile.WeightedCG.IRNodes[ir.LinkFuncName(fn)]; ok { if _, ok := candHotCalleeMap[n]; ok { - budget = int32(inlineHotMaxBudget) + budget = inlineHotMaxBudget if verbose { fmt.Printf("hot-node enabled increased budget=%v for func=%v\n", budget, ir.PkgFuncName(fn)) } @@ -322,10 +322,9 @@ func CanInline(fn *ir.Func, profile *pgo.Profile) { } n.Func.Inl = &ir.Inline{ - Cost: budget - visitor.budget, - Dcl: pruneUnusedAutos(n.Func.Dcl, &visitor), - HaveDcl: true, - + Cost: budget - visitor.budget, + Dcl: pruneUnusedAutos(n.Func.Dcl, &visitor), + HaveDcl: true, CanDelayResults: canDelayResults(fn), } if base.Flag.LowerM != 0 || logopt.Enabled() { diff --git a/src/cmd/compile/internal/inline/inlheur/analyze.go b/src/cmd/compile/internal/inline/inlheur/analyze.go index a1b6f358e1..1fb502ac2a 100644 --- a/src/cmd/compile/internal/inline/inlheur/analyze.go +++ b/src/cmd/compile/internal/inline/inlheur/analyze.go @@ -95,7 +95,7 @@ func AnalyzeFunc(fn *ir.Func, canInline func(*ir.Func), budgetForFunc func(*ir.F // only after the closures it contains have been processed, so // iterate through the list in reverse order. Once a function has // been analyzed, revisit the question of whether it should be - // inlinable; if it is over the default hairyness limit and it + // inlinable; if it is over the default hairiness limit and it // doesn't have any interesting properties, then we don't want // the overhead of writing out its inline body. nameFinder := newNameFinder(fn) diff --git a/src/cmd/compile/internal/inline/inlheur/scoring.go b/src/cmd/compile/internal/inline/inlheur/scoring.go index 623ba8adf0..3de95d46b4 100644 --- a/src/cmd/compile/internal/inline/inlheur/scoring.go +++ b/src/cmd/compile/internal/inline/inlheur/scoring.go @@ -590,7 +590,7 @@ func GetCallSiteScore(fn *ir.Func, call *ir.CallExpr) (int, bool) { // BudgetExpansion returns the amount to relax/expand the base // inlining budget when the new inliner is turned on; the inliner -// will add the returned value to the hairyness budget. +// will add the returned value to the hairiness budget. // // Background: with the new inliner, the score for a given callsite // can be adjusted down by some amount due to heuristics, however we @@ -617,7 +617,7 @@ var allCallSites CallSiteTab // along with info on call site scoring and the adjustments made to a // given score. Here profile is the PGO profile in use (may be // nil), budgetCallback is a callback that can be invoked to find out -// the original pre-adjustment hairyness limit for the function, and +// the original pre-adjustment hairiness limit for the function, and // inlineHotMaxBudget is the constant of the same name used in the // inliner. Sample output lines: // @@ -629,7 +629,7 @@ var allCallSites CallSiteTab // // In the dump above, "Score" is the final score calculated for the // callsite, "Adjustment" is the amount added to or subtracted from -// the original hairyness estimate to form the score. "Status" shows +// the original hairiness estimate to form the score. "Status" shows // whether anything changed with the site -- did the adjustment bump // it down just below the threshold ("PROMOTED") or instead bump it // above the threshold ("DEMOTED"); this will be blank ("---") if no diff --git a/src/cmd/compile/internal/inline/interleaved/interleaved.go b/src/cmd/compile/internal/inline/interleaved/interleaved.go index a6f19d470d..8956080240 100644 --- a/src/cmd/compile/internal/inline/interleaved/interleaved.go +++ b/src/cmd/compile/internal/inline/interleaved/interleaved.go @@ -39,7 +39,7 @@ func DevirtualizeAndInlinePackage(pkg *ir.Package, profile *pgo.Profile) { inlProfile = profile } if inlProfile != nil { - inline.PGOInlinePrologue(inlProfile, pkg.Funcs) + inline.PGOInlinePrologue(inlProfile) } ir.VisitFuncsBottomUp(pkg.Funcs, func(funcs []*ir.Func, recursive bool) { diff --git a/src/internal/profile/graph.go b/src/internal/profile/graph.go index 88d5311927..0e8e33c1ac 100644 --- a/src/internal/profile/graph.go +++ b/src/internal/profile/graph.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package graph represents a pprof profile as a directed graph. +// Package profile represents a pprof profile as a directed graph. // // This package is a simplified fork of github.com/google/pprof/internal/graph. package profile -- 2.48.1