mirror of
https://github.com/golang/go
synced 2024-09-30 05:34:35 -06:00
cmd/compile: simplify zcse
Minor refactoring. Passes toolstash-check. Change-Id: I91e981bf369d4b719163107644fa58f583356c25 Reviewed-on: https://go-review.googlesource.com/c/go/+/229598 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
708ac9aacb
commit
806318d6ad
@ -15,9 +15,8 @@ func zcse(f *Func) {
|
||||
vals := make(map[vkey]*Value)
|
||||
|
||||
for _, b := range f.Blocks {
|
||||
for i := 0; i < len(b.Values); {
|
||||
for i := 0; i < len(b.Values); i++ {
|
||||
v := b.Values[i]
|
||||
next := true
|
||||
if opcodeTable[v.Op].argLen == 0 {
|
||||
key := vkey{v.Op, keyFor(v), v.Aux, v.Type}
|
||||
if vals[key] == nil {
|
||||
@ -33,14 +32,10 @@ func zcse(f *Func) {
|
||||
b.Values[last] = nil
|
||||
b.Values = b.Values[:last]
|
||||
|
||||
// process b.Values[i] again
|
||||
next = false
|
||||
i-- // process b.Values[i] again
|
||||
}
|
||||
}
|
||||
}
|
||||
if next {
|
||||
i++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user