]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: enhance tighten pass for memory values
authoreric fang <eric.fang@arm.com>
Fri, 5 May 2023 01:07:25 +0000 (01:07 +0000)
committerEric Fang <eric.fang@arm.com>
Tue, 16 May 2023 01:01:38 +0000 (01:01 +0000)
commite0ceba8139c81d612ab6226e057fb3b01555b7f9
treedfae2ccaba1861b7d1a8ed5346a8a8ddbcf0a8e4
parent5f345e8eb995409fec5e1abf231031613885f2ae
cmd/compile: enhance tighten pass for memory values

[This is a roll-forward of CL 458755, which was reverted due to make.bash
being broken on GOAMD64=v3. But it turned out that the problem was caused
by wrong bswap/load rewrite rules, and it was fixed in CL 492616.]

This CL enhances the tighten pass. Previously if a value has memory arg,
then the tighten pass won't move it, actually if the memory state is
consistent among definition and use block, we can move the value. This
CL optimizes this case. This is useful for the following situation:
b1:
  x = load(...mem)
  if(...) goto b2 else b3
b2:
  use(x)
b3:
  some_op_not_use_x

For the micro-benchmark mentioned in #56620, the performance improvement
is about 15%.
There's no noticeable performance change in the go1 benchmark.

Fixes #56620

Change-Id: I36ea68bed384986cd3ae81cb9e6efe84bb213adc
Reviewed-on: https://go-review.googlesource.com/c/go/+/492895
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>
src/cmd/compile/internal/ssa/regalloc.go
src/cmd/compile/internal/ssa/tighten.go
test/tighten.go [new file with mode: 0644]