]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: do not allow regalloc to LoadReg G register
authorDavid Chase <drchase@google.com>
Fri, 25 May 2018 20:08:13 +0000 (16:08 -0400)
committerDavid Chase <drchase@google.com>
Wed, 30 May 2018 16:39:21 +0000 (16:39 +0000)
commit31e1c30f55165785dd12e7c67babedeb950a721d
tree55ab705ca77332a378a820df25e08824a625dd1b
parentd5bc3b96c6fb758561e6274c8f69232623157ca4
cmd/compile: do not allow regalloc to LoadReg G register

On architectures where G is stored in a register, it is
possible for a variable to allocated to it, and subsequently
that variable may be spilled and reloaded, for example
because of an intervening call.  If such an allocation
reaches a join point and it is the primary predecessor,
it becomes the target of a reload, which is only usually
right.

Fix: guard all the LoadReg ops, and spill value in the G
register (if any) before merges (in the same way that 387
FP registers are freed between blocks).

Includes test.

Fixes #25504.

Change-Id: I0482a53e20970c7315bf09c0e407ae5bba2fe05d
Reviewed-on: https://go-review.googlesource.com/114695
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/export_test.go
src/cmd/compile/internal/ssa/regalloc.go
src/cmd/compile/internal/ssa/regalloc_test.go