]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: when combining stores, use line number of first store
authorKeith Randall <khr@golang.org>
Mon, 21 Aug 2023 22:55:35 +0000 (15:55 -0700)
committerKeith Randall <khr@google.com>
Thu, 12 Oct 2023 18:09:26 +0000 (18:09 +0000)
commit657c885fb9278f03d5b18bfb7eeca98c25ef67ac
tree23115ea07b0ff35fdd54c66172928f8f6c7f9fb0
parente4f72f773666b8f13ed5d053abf87ca42c68cc16
cmd/compile: when combining stores, use line number of first store

var p *[2]uint32 = ...
p[0] = 0
p[1] = 0

When we combine these two 32-bit stores into a single 64-bit store,
use the line number of the first store, not the second one.
This differs from the default behavior because usually with the combining
that the compiler does, we use the line number of the last instruction
in the combo (e.g. load+add, we use the line number of the add).

This is the same behavior that gcc does in C (picking the line
number of the first of a set of combined stores).

Change-Id: Ie70bf6151755322d33ecd50e4d9caf62f7881784
Reviewed-on: https://go-review.googlesource.com/c/go/+/521678
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/_gen/AMD64.rules
src/cmd/compile/internal/ssa/_gen/ARM64.rules
src/cmd/compile/internal/ssa/_gen/S390X.rules
src/cmd/compile/internal/ssa/memcombine.go
src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewriteARM64.go
src/cmd/compile/internal/ssa/rewriteS390X.go
test/codegen/memcombine.go