]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/inline: analyze function param properties
authorThan McIntosh <thanm@google.com>
Fri, 30 Jun 2023 20:44:31 +0000 (16:44 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 8 Sep 2023 23:01:53 +0000 (23:01 +0000)
commit906a073b0badf3c76cb8225f376195da594fe5b4
tree2444da4d0f2f8580c9d427a9655449ce0ba88f2b
parent2fe2f0854293e601bac60bb5d3aa6e276fadf084
cmd/compile/internal/inline: analyze function param properties

Add code to analyze properties of function params, specifically
heuristics to look for cases where unmodified params feed into "if"
and "switch" statements in ways that might enable constant folding
and/or dead code elimination if the call were inlined at a callsite
that passes a constant to the correct param. We also look for cases
where a function parameter feeds unmodified into an interface method
call or indirect call.

Updates #61502.

Change-Id: Iaf7297e19637daeabd0ec72be88d654b545546ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/511561
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/inline/inlheur/analyze.go
src/cmd/compile/internal/inline/inlheur/analyze_func_params.go [new file with mode: 0644]
src/cmd/compile/internal/inline/inlheur/eclassify.go [new file with mode: 0644]
src/cmd/compile/internal/inline/inlheur/funcprops_test.go
src/cmd/compile/internal/inline/inlheur/testdata/props/funcflags.go
src/cmd/compile/internal/inline/inlheur/testdata/props/params.go [new file with mode: 0644]
src/cmd/compile/internal/inline/inlheur/testdata/props/returns.go
src/cmd/compile/internal/inline/inlheur/texpr_classify_test.go [new file with mode: 0644]