From 806318d6ad39e3839183ffbbd9b56a690c0379d1 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Wed, 22 Apr 2020 21:34:48 -0700 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/cmd/compile/internal/ssa/zcse.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cmd/compile/internal/ssa/zcse.go b/src/cmd/compile/internal/ssa/zcse.go index 44688d9573..ec38b7d1ba 100644 --- a/src/cmd/compile/internal/ssa/zcse.go +++ b/src/cmd/compile/internal/ssa/zcse.go @@ -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++ - } } } -- 2.50.0