mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: in clobberdead mode, don't clobber slots that are live for defers
There are stack slots that are kept live for defers, which are tracked separately. Don't clobber them. Change-Id: Ib558345758b5a4fd89c7ff8a3fe08087059add21 Reviewed-on: https://go-review.googlesource.com/c/go/+/310329 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
This commit is contained in:
parent
4fb74e0555
commit
9fbcba6664
1 changed files with 3 additions and 1 deletions
|
|
@ -995,9 +995,11 @@ func (lv *liveness) clobber(b *ssa.Block) {
|
||||||
// of b.Values.
|
// of b.Values.
|
||||||
func clobber(lv *liveness, b *ssa.Block, live bitvec.BitVec) {
|
func clobber(lv *liveness, b *ssa.Block, live bitvec.BitVec) {
|
||||||
for i, n := range lv.vars {
|
for i, n := range lv.vars {
|
||||||
if !live.Get(int32(i)) && !n.Addrtaken() {
|
if !live.Get(int32(i)) && !n.Addrtaken() && !n.OpenDeferSlot() && !n.IsOutputParamHeapAddr() {
|
||||||
// Don't clobber stack objects (address-taken). They are
|
// Don't clobber stack objects (address-taken). They are
|
||||||
// tracked dynamically.
|
// tracked dynamically.
|
||||||
|
// Also don't clobber slots that are live for defers (see
|
||||||
|
// the code setting livedefer in epilogue).
|
||||||
clobberVar(b, n)
|
clobberVar(b, n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue