Skip to content

Commit 075880a

Browse files
committed
cmd/compile: fix build
Run live vars test only on ssa builds. We can't just drop KeepAlive ops during regalloc. We need to replace them with copies. Change-Id: Ib4b3b1381415db88fdc2165fc0a9541b73ad9759 Reviewed-on: https://go-review.googlesource.com/23225 Run-TryBot: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 6ab45c0 commit 075880a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/cmd/compile/internal/ssa/regalloc.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,13 +948,14 @@ func (s *regAllocState) regalloc(f *Func) {
948948
if vi.spillUsed {
949949
// Use the spill location.
950950
v.SetArg(0, vi.spill)
951-
b.Values = append(b.Values, v)
952951
} else {
953952
// No need to keep unspilled values live.
954953
// These are typically rematerializeable constants like nil,
955954
// or values of a variable that were modified since the last call.
956-
v.Args[0].Uses--
955+
v.Op = OpCopy
956+
v.SetArgs1(v.Args[1])
957957
}
958+
b.Values = append(b.Values, v)
958959
continue
959960
}
960961
regspec := opcodeTable[v.Op].reg

test/fixedbugs/issue15277.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// Copyright 2016 The Go Authors. All rights reserved.
44
// Use of this source code is governed by a BSD-style
55
// license that can be found in the LICENSE file.
6+
// +build amd64
67

78
package main
89

0 commit comments

Comments
 (0)