1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:54:40 -07:00

cmd/compile: use optimized slice zeroing in deadcode

Minor cleanup. Passes toolstash-check.

Change-Id: I97a027c4ca49ded593e9c7989e9e091ab9336fa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/227318
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Josh Bleecher Snyder 2019-05-28 14:29:28 -07:00
parent b6feb03b24
commit 3c8101c7e4

View File

@ -242,8 +242,9 @@ func deadcode(f *Func) {
f.NamedValues[name] = values[:j] f.NamedValues[name] = values[:j]
} }
} }
for k := len(f.Names) - 1; k >= i; k-- { clearNames := f.Names[i:]
f.Names[k] = LocalSlot{} for j := range clearNames {
clearNames[j] = LocalSlot{}
} }
f.Names = f.Names[:i] f.Names = f.Names[:i]
@ -311,8 +312,9 @@ func deadcode(f *Func) {
i++ i++
} }
} }
for j := i; j < len(f.WBLoads); j++ { clearWBLoads := f.WBLoads[i:]
f.WBLoads[j] = nil for j := range clearWBLoads {
clearWBLoads[j] = nil
} }
f.WBLoads = f.WBLoads[:i] f.WBLoads = f.WBLoads[:i]