$ the-wire · showcase
Compiler gains mem2reg and stats passes
By RepoJournal · Filed · About Go · Composed from the cited sources · methodology
Two new cmd/compile passes land the same day: one promotes address-taken stack variables to SSA values, the other builds the statistics infrastructure to measure what the compiler is doing.
cmd/compile: add mem2reg pass golang/go
Junyang Shao's mem2reg pass, a translation of LLVM's PromoteMemoryToRegister, promotes address-taken stack variables to SSA values when the address is only used by loads and stores: stores become the variable's current value, loads are replaced by that value, and the memory operations and their VarDefs are removed. It targets scalar variables only for now.
cmd/compile: add compiler statistics golang/go
A new stats package in cmd/compile/internal ships alongside a ptr stats pass that collects pointer demographics, plus a compiler flag to control statistics. The measurement plumbing has to exist before any pass can be judged on the numbers it moves.
cmd: update vendored x/arch golang/go
Michael Stapelberg bumped the vendored x/arch to ab53fe6c43b6 for BMI instructions, built with go get golang.org/x/arch@master followed by go mod tidy and go mod vendor from GOROOT/src/cmd.