]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/inline/inlheur: rescore callsites based on result use
authorThan McIntosh <thanm@google.com>
Thu, 17 Aug 2023 19:30:23 +0000 (15:30 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 15 Sep 2023 12:45:59 +0000 (12:45 +0000)
commit00073c25f65947dc4a331dcc6b20cb215fb03341
treeb64ea85391d41576134ef0678c7942a5b96ba2e5
parenta9cfbec17b12166c56aeb9808b5d1b7393e90f43
cmd/compile/internal/inline/inlheur: rescore callsites based on result use

Add a post-processing pass that updates the scores on callsites based
on how their results are used. This is similar to the "param feeds
unmodified into <XXX>" heuristics, but applies to returned results
instead: if we know that function F always returns a constant, and we
can see that the result from a given call feeds unmodified into an
if/switch, then decrease the score on the call to encourage inlining.

Change-Id: If513765c79d868cbdf672facbff9d92ad24f909e
Reviewed-on: https://go-review.googlesource.com/c/go/+/521819
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/inline/inlheur/analyze.go
src/cmd/compile/internal/inline/inlheur/analyze_func_callsites.go
src/cmd/compile/internal/inline/inlheur/funcprops_test.go
src/cmd/compile/internal/inline/inlheur/score_callresult_uses.go [new file with mode: 0644]
src/cmd/compile/internal/inline/inlheur/scoreadjusttyp_string.go
src/cmd/compile/internal/inline/inlheur/scoring.go
src/cmd/compile/internal/inline/inlheur/testdata/props/returns2.go [new file with mode: 0644]