]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: enhance tighten pass for memory values
authorerifan01 <eric.fang@arm.com>
Thu, 15 Dec 2022 08:39:07 +0000 (16:39 +0800)
committerGopher Robot <gobot@golang.org>
Wed, 3 May 2023 19:56:09 +0000 (19:56 +0000)
commitea8f03799692c5b6a3e0ef36aa95cf290db39b4c
tree8d8d82d483e9cb7805956cea5de9e31cd7d2803b
parentc486f74eeb77548d74fd09b624d4a1cf1b3ab9c4
cmd/compile: enhance tighten pass for memory values

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: I9b152754f27231f583a6995fc7cd8472aa7d390c
Reviewed-on: https://go-review.googlesource.com/c/go/+/458755
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/regalloc.go
src/cmd/compile/internal/ssa/tighten.go
test/tighten.go [new file with mode: 0644]