1
0
mirror of https://github.com/golang/go synced 2024-11-23 16:40:03 -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]
}
}
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]