]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: add Value.Uses comparison during scheduling
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 23 Apr 2020 22:30:19 +0000 (15:30 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 24 Apr 2020 21:12:21 +0000 (21:12 +0000)
commit943a0d02d18bba5243f235fbbebd7f29d49d991e
tree1ad2b855792579039983707e0af5aa6a16e1139f
parent512277dc19b918da19e083c28427109256ef9309
cmd/compile: add Value.Uses comparison during scheduling

Falling back to comparing Value.ID during scheduling
is undesirable: Not only are we simply hoping for a good
outcome, but the decision we make will be easily perturbed
by other compiler changes, leading to random fluctuations.

This change adds another decision point to the scheduler
by scheduling Values with many uses earlier.
Values with fewer uses are less likely to be spilled for
other reasons, so we should issue them as late as possible
in the hope of avoiding a spill.

This reduces the number of Value ID comparisons
in schedule while running make.bash
from 1,000,844 to 542,442.

As you would expect, this changes a lot of functions,
but the overall trend is positive:

file    before    after     Δ       %
api     5237184   5233088   -4096   -0.078%
compile 19926480  19918288  -8192   -0.041%
cover   5281816   5277720   -4096   -0.078%
dist    3711608   3707512   -4096   -0.110%
total   113588440 113567960 -20480  -0.018%

Change-Id: Ic99ebc4c614d4ae3807ce44473ec6b04684388ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/229798
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/schedule.go