mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: use the right type for spill slot
Currently, when shuffling registers, if we need to spill a register, we always create a spill slot of type int64. The type doesn't actually matter, as long as it is wide enough to hold the registers. This is no longer true with SIMD registers, which could be wider than a int64. Create the slot with the proper type instead. Cherry-picked from the dev.simd branch. This CL is not necessarily SIMD specific. Apply early to reduce risk. Test is SIMD specific so not included for now. Change-Id: I85c82e2532001bfdefe98c9446f2dd18583d49b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/704055 TryBot-Bypass: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/708860 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
1caa95acfa
commit
18cd4a1fc7
2 changed files with 2 additions and 5 deletions
|
|
@ -2690,7 +2690,6 @@ func (e *edgeState) erase(loc Location) {
|
|||
// findRegFor finds a register we can use to make a temp copy of type typ.
|
||||
func (e *edgeState) findRegFor(typ *types.Type) Location {
|
||||
// Which registers are possibilities.
|
||||
types := &e.s.f.Config.Types
|
||||
m := e.s.compatRegs(typ)
|
||||
|
||||
// Pick a register. In priority order:
|
||||
|
|
@ -2724,9 +2723,7 @@ func (e *edgeState) findRegFor(typ *types.Type) Location {
|
|||
if !c.rematerializeable() {
|
||||
x := e.p.NewValue1(c.Pos, OpStoreReg, c.Type, c)
|
||||
// Allocate a temp location to spill a register to.
|
||||
// The type of the slot is immaterial - it will not be live across
|
||||
// any safepoint. Just use a type big enough to hold any register.
|
||||
t := LocalSlot{N: e.s.f.NewLocal(c.Pos, types.Int64), Type: types.Int64}
|
||||
t := LocalSlot{N: e.s.f.NewLocal(c.Pos, c.Type), Type: c.Type}
|
||||
// TODO: reuse these slots. They'll need to be erased first.
|
||||
e.set(t, vid, x, false, c.Pos)
|
||||
if e.s.f.pass.debug > regDebug {
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ func (v *Value) removeable() bool {
|
|||
func AutoVar(v *Value) (*ir.Name, int64) {
|
||||
if loc, ok := v.Block.Func.RegAlloc[v.ID].(LocalSlot); ok {
|
||||
if v.Type.Size() > loc.Type.Size() {
|
||||
v.Fatalf("spill/restore type %s doesn't fit in slot type %s", v.Type, loc.Type)
|
||||
v.Fatalf("v%d: spill/restore type %v doesn't fit in slot type %v", v.ID, v.Type, loc.Type)
|
||||
}
|
||||
return loc.N, loc.Off
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue