diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go index 03243e9d6b..c38d2a45bf 100644 --- a/src/cmd/compile/internal/gc/plive.go +++ b/src/cmd/compile/internal/gc/plive.go @@ -583,7 +583,6 @@ func livenesssolve(lv *Liveness) { // variables at each safe point locations. func livenessepilogue(lv *Liveness) { nvars := int32(len(lv.vars)) - livein := bvalloc(nvars) liveout := bvalloc(nvars) any := bvalloc(nvars) all := bvalloc(nvars) @@ -655,9 +654,7 @@ func livenessepilogue(lv *Liveness) { // Annotate ambiguously live variables so that they can // be zeroed at function entry. - // livein and liveout are dead here and used as temporaries. - livein.Clear() - + // liveout is dead here and used as a temporary. liveout.AndNot(any, all) if !liveout.IsEmpty() { for pos := int32(0); pos < liveout.n; pos++ { @@ -688,51 +685,44 @@ func livenessepilogue(lv *Liveness) { be := lv.blockEffects(b) // walk backward, emit pcdata and populate the maps - pos := int32(be.lastbitmapindex) - if pos < 0 { + index := int32(be.lastbitmapindex) + if index < 0 { // the first block we encounter should have the ATEXT so // at no point should pos ever be less than zero. Fatalf("livenessepilogue") } - livein.Copy(be.liveout) + liveout.Copy(be.liveout) for i := len(b.Values) - 1; i >= 0; i-- { v := b.Values[i] - // Propagate liveness information - { - pos, e := lv.valueEffects(v) - liveout.Copy(livein) - if e&varkill != 0 { - livein.Unset(pos) - } - if e&uevar != 0 { - livein.Set(pos) - } + if issafepoint(v) { + // Found an interesting instruction, record the + // corresponding liveness information. + + live := lv.livevars[index] + live.Or(live, liveout) + live.Or(live, livedefer) // only for non-entry safe points + index-- } - if !issafepoint(v) { - continue + // Update liveness information. + pos, e := lv.valueEffects(v) + if e&varkill != 0 { + liveout.Unset(pos) + } + if e&uevar != 0 { + liveout.Set(pos) } - - // Found an interesting instruction, record the - // corresponding liveness information. - - // Record live variables. - live := lv.livevars[pos] - live.Or(live, liveout) - live.Or(live, livedefer) // only for non-entry safe points - - pos-- } if b == lv.f.Entry { - if pos != 0 { - Fatalf("bad pos for entry point: %v", pos) + if index != 0 { + Fatalf("bad index for entry point: %v", index) } // Record live variables. - live := lv.livevars[pos] + live := lv.livevars[index] live.Or(live, liveout) } }