Skip to content

Commit

Permalink
cmd/compile: delete unused code and fix typo in comment
Browse files Browse the repository at this point in the history
Change-Id: Ia1f1c7d5563a74950c47cf3ebdcb600b34c83e85
GitHub-Last-Rev: bd58214
GitHub-Pull-Request: #65527
Reviewed-on: https://go-review.googlesource.com/c/go/+/561355
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
Jun10ng authored and gopherbot committed Feb 5, 2024
1 parent b39ec94 commit 6076edc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
17 changes: 8 additions & 9 deletions src/cmd/compile/internal/inline/inl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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))
}
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/inline/inlheur/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/compile/internal/inline/inlheur/scoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
//
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/inline/interleaved/interleaved.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/internal/profile/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6076edc

Please sign in to comment.