diff --git a/src/cmd/compile/internal/ssa/deadcode.go b/src/cmd/compile/internal/ssa/deadcode.go index b79ec7c2f6..395c1617e5 100644 --- a/src/cmd/compile/internal/ssa/deadcode.go +++ b/src/cmd/compile/internal/ssa/deadcode.go @@ -242,8 +242,9 @@ func deadcode(f *Func) { f.NamedValues[name] = values[:j] } } - for k := len(f.Names) - 1; k >= i; k-- { - f.Names[k] = LocalSlot{} + clearNames := f.Names[i:] + for j := range clearNames { + clearNames[j] = LocalSlot{} } f.Names = f.Names[:i] @@ -311,8 +312,9 @@ func deadcode(f *Func) { i++ } } - for j := i; j < len(f.WBLoads); j++ { - f.WBLoads[j] = nil + clearWBLoads := f.WBLoads[i:] + for j := range clearWBLoads { + clearWBLoads[j] = nil } f.WBLoads = f.WBLoads[:i]