cmd/compile: only clobber dead slots at call sites
We now have safepoints at nearly all the instructions. When
GOEXPERIMENT=clobberdead is on, it inserts clobbers nearly at
every instruction. Currently this doesn't work. (Maybe the stack
maps at non-call safepoints are still imprecise. I haven't
investigated.) For now, only use call-based safepoints if the
experiment is on.
Updates #27326.
Change-Id: I72cda9b422d9637cc5738e681502035af7a5c02d
Reviewed-on: https://go-review.googlesource.com/131956
Reviewed-by: Keith Randall <khr@golang.org>
diff --git a/src/cmd/compile/internal/gc/plive.go b/src/cmd/compile/internal/gc/plive.go
index f78d051..be53384 100644
--- a/src/cmd/compile/internal/gc/plive.go
+++ b/src/cmd/compile/internal/gc/plive.go
@@ -671,7 +671,7 @@
// markUnsafePoints finds unsafe points and computes lv.unsafePoints.
func (lv *Liveness) markUnsafePoints() {
- if compiling_runtime || lv.f.NoSplit {
+ if compiling_runtime || lv.f.NoSplit || objabi.Clobberdead_enabled != 0 {
// No complex analysis necessary. Do this on the fly
// in issafepoint.
return
@@ -830,7 +830,7 @@
// go:nosplit functions are similar. Since safe points used to
// be coupled with stack checks, go:nosplit often actually
// means "no safe points in this function".
- if compiling_runtime || lv.f.NoSplit {
+ if compiling_runtime || lv.f.NoSplit || objabi.Clobberdead_enabled != 0 {
return v.Op.IsCall()
}
switch v.Op {