From 9552295833ddec28f1e4dffc8f3e80b6448e6f83 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 11 Sep 2015 10:28:33 -0700 Subject: [PATCH] [dev.ssa] cmd/compile: minor CSE cleanup Remove unnecessary local var split. Change-Id: I907ef682b5fd9b3a67771edd1fe90c558f8937ea Reviewed-on: https://go-review.googlesource.com/14523 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Keith Randall --- src/cmd/compile/internal/ssa/cse.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cmd/compile/internal/ssa/cse.go b/src/cmd/compile/internal/ssa/cse.go index 3b007c6192..25f424fbee 100644 --- a/src/cmd/compile/internal/ssa/cse.go +++ b/src/cmd/compile/internal/ssa/cse.go @@ -92,20 +92,18 @@ func cse(f *Func) { // all values in this equiv class that are not equivalent to v get moved // into another equiv class. // To avoid allocating while building that equivalence class, - // move the values equivalent to v to the beginning of e, - // other values to the end of e, and track where the split is. + // move the values equivalent to v to the beginning of e + // and other values to the end of e. allvals := e - split := len(e) eqloop: for j := 1; j < len(e); { w := e[j] for i := 0; i < len(v.Args); i++ { if valueEqClass[v.Args[i].ID] != valueEqClass[w.Args[i].ID] || !v.Type.Equal(w.Type) { // w is not equivalent to v. - // move it to the end, shrink e, and move the split. + // move it to the end and shrink e. e[j], e[len(e)-1] = e[len(e)-1], e[j] e = e[:len(e)-1] - split-- valueEqClass[w.ID] = len(partition) changed = true continue eqloop @@ -115,8 +113,8 @@ func cse(f *Func) { j++ } partition[i] = e - if split < len(allvals) { - partition = append(partition, allvals[split:]) + if len(e) < len(allvals) { + partition = append(partition, allvals[len(e):]) } }