[go] cmd/compile: handle multiply-assigned func vars in escape analysis

0 views
Skip to first unread message

Keith Randall (Gerrit)

unread,
12:48 PM (5 hours ago) 12:48 PM
to Keith Randall, Jake Bailey, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Keith Randall, Dmitri Shuralyov, golang...@luci-project-accounts.iam.gserviceaccount.com, Dmitri Shuralyov, t hepudds, Mateusz Poliwczak, golang-co...@googlegroups.com

Keith Randall submitted the change

Change information

Commit message:
cmd/compile: handle multiply-assigned func vars in escape analysis

Generalize FuncSingleAssignment to FuncAssignments, tracking all
non-zero assignments to func-typed variables. When multiple
callees are known, escape analysis merges their parameter escape
behaviors via teeHole.

compilebench results (this CL vs parent):

│ parent.txt │ commit.txt │
│ sec/op │ sec/op vs base │
Template 150.8m ± 12% 149.6m ± 12% ~ (p=0.589 n=6)
Unicode 120.2m ± 11% 117.2m ± 5% ~ (p=0.699 n=6)
GoTypes 890.6m ± 3% 884.8m ± 2% ~ (p=0.310 n=6)
Compiler 161.2m ± 13% 154.4m ± 4% ~ (p=0.180 n=6)
SSA 7.023 ± 1% 7.021 ± 1% ~ (p=0.485 n=6)
Flate 162.6m ± 6% 162.0m ± 6% ~ (p=0.699 n=6)
GoParser 176.9m ± 7% 178.0m ± 6% ~ (p=0.699 n=6)
Reflect 393.2m ± 4% 389.5m ± 5% ~ (p=0.699 n=6)
Tar 171.5m ± 14% 172.9m ± 5% ~ (p=0.937 n=6)
XML 197.1m ± 6% 197.7m ± 2% ~ (p=0.818 n=6)
LinkCompiler 650.5m ± 4% 637.0m ± 2% ~ (p=0.394 n=6)
ExternalLinkCompiler 2.196 ± 1% 2.206 ± 1% ~ (p=0.240 n=6)
LinkWithoutDebugCompiler 421.2m ± 6% 423.4m ± 7% ~ (p=0.699 n=6)
StdCmd 29.21 ± 2% 29.27 ± 1% ~ (p=0.937 n=6)
geomean 525.6m 522.3m -0.63%

│ parent.txt │ commit.txt │
│ user-sec/op │ user-sec/op vs base │
Template 728.1m ± 5% 686.9m ± 11% ~ (p=0.180 n=6)
Unicode 158.9m ± 12% 160.9m ± 8% ~ (p=0.937 n=6)
GoTypes 4.921 ± 4% 4.919 ± 2% ~ (p=0.937 n=6)
Compiler 502.4m ± 9% 505.3m ± 10% ~ (p=0.818 n=6)
SSA 37.77 ± 2% 37.06 ± 4% ~ (p=0.699 n=6)
Flate 751.3m ± 11% 759.7m ± 8% ~ (p=0.937 n=6)
GoParser 677.4m ± 5% 674.4m ± 8% ~ (p=0.394 n=6)
Reflect 1.888 ± 2% 1.901 ± 3% ~ (p=0.589 n=6)
Tar 772.1m ± 14% 789.7m ± 5% ~ (p=0.937 n=6)
XML 911.8m ± 9% 916.0m ± 12% ~ (p=0.937 n=6)
LinkCompiler 1.077 ± 4% 1.059 ± 5% ~ (p=0.310 n=6)
ExternalLinkCompiler 2.539 ± 2% 2.531 ± 3% ~ (p=1.000 n=6)
LinkWithoutDebugCompiler 489.7m ± 4% 485.3m ± 5% ~ (p=1.000 n=6)
geomean 1.192 1.187 -0.36%

│ parent.txt │ commit.txt │
│ text-bytes │ text-bytes vs base │
HelloSize 1.110Mi ± 0% 1.110Mi ± 0% ~ (p=1.000 n=6) ¹
CmdGoSize 14.14Mi ± 0% 14.14Mi ± 0% ~ (p=1.000 n=6) ¹
geomean 3.961Mi 3.961Mi +0.00%
¹ all samples are equal

│ parent.txt │ commit.txt │
│ data-bytes │ data-bytes vs base │
HelloSize 27.54Ki ± 0% 27.54Ki ± 0% ~ (p=1.000 n=6) ¹
CmdGoSize 431.4Ki ± 0% 431.4Ki ± 0% ~ (p=1.000 n=6) ¹
geomean 109.0Ki 109.0Ki +0.00%
¹ all samples are equal

│ parent.txt │ commit.txt │
│ bss-bytes │ bss-bytes vs base │
HelloSize 213.9Ki ± 0% 213.9Ki ± 0% ~ (p=1.000 n=6) ¹
CmdGoSize 32.27Mi ± 0% 32.27Mi ± 0% ~ (p=1.000 n=6) ¹
geomean 2.597Mi 2.597Mi +0.00%
¹ all samples are equal

│ parent.txt │ commit.txt │
│ exe-bytes │ exe-bytes vs base │
HelloSize 1.782Mi ± 0% 1.782Mi ± 0% ~ (p=1.000 n=6) ¹
CmdGoSize 21.29Mi ± 0% 21.29Mi ± 0% ~ (p=1.000 n=6) ¹
geomean 6.158Mi 6.158Mi +0.00%
¹ all samples are equal

Fixes #73132
Change-Id: Ice3ed672db28dbfd4bdc788019111d5d3092c5bb
Reviewed-by: Keith Randall <k...@google.com>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Reviewed-by: Keith Randall <k...@golang.org>
Files:
  • M src/cmd/compile/internal/escape/call.go
  • M src/cmd/compile/internal/ir/expr.go
  • M test/escape_closure.go
Change size: M
Delta: 3 files changed, 142 insertions(+), 28 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ice3ed672db28dbfd4bdc788019111d5d3092c5bb
Gerrit-Change-Number: 771500
Gerrit-PatchSet: 24
Gerrit-Owner: Jake Bailey <jacob.b...@gmail.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Jake Bailey <jacob.b...@gmail.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Mateusz Poliwczak <mpoliw...@gmail.com>
Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages