[dev.ssa] cmd/compile: don't flush a value derived from the current value

If flushing a value from a register that might be used by the current
old-schedule value, save it to the home location.

This resolves the error that was changed from panic to unimplemented in
CL 12655.

Change-Id: If864be34abcd6e11d6117a061376e048a3e29b3a
Reviewed-on: https://go-review.googlesource.com/12682
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Todd Neal 2015-07-26 09:48:20 -05:00
parent b61f8c8df3
commit c9a38ce758
2 changed files with 22 additions and 2 deletions

View file

@ -238,7 +238,7 @@ func regalloc(f *Func) {
if regs[r].v != nil {
x := regs[r].v
c := regs[r].c
if regs[r].dirty && lastUse[x.ID] > idx {
if regs[r].dirty && lastUse[x.ID] >= idx {
// Write x back to home. Its value is currently held in c.
x.Op = OpStoreReg
x.Aux = nil
@ -317,7 +317,7 @@ func regalloc(f *Func) {
if regs[r].v != nil {
x := regs[r].v
c := regs[r].c
if regs[r].dirty && lastUse[x.ID] > idx {
if regs[r].dirty && lastUse[x.ID] >= idx {
// Write x back to home. Its value is currently held in c.
x.Op = OpStoreReg
x.Aux = nil