]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: remove redundant compare ops
authorKeith Randall <khr@golang.org>
Fri, 5 Feb 2016 02:02:03 +0000 (18:02 -0800)
committerKeith Randall <khr@golang.org>
Thu, 11 Feb 2016 21:01:17 +0000 (21:01 +0000)
Flagalloc was recalculating flags is some situations
when it didn't need to.  Fixed by using the same name
for the original flag calculation instruction throughout.

Change-Id: Ic0bf58f728a8d87748434dd25a67b0708755e1f8
Reviewed-on: https://go-review.googlesource.com/19237
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/flagalloc.go

index 85e9c4fbeedb7e709f652d037c743caa3af8c789..7ed1fe5908f8e84b9e638be1d36101088322cd43 100644 (file)
@@ -66,7 +66,7 @@ func flagalloc(f *Func) {
        for _, b := range f.Blocks {
                oldSched = append(oldSched[:0], b.Values...)
                b.Values = b.Values[:0]
-               // The current live flag value.
+               // The current live flag value the pre-flagalloc copy).
                var flag *Value
                if len(b.Preds) > 0 {
                        flag = end[b.Preds[0].ID]
@@ -95,7 +95,7 @@ func flagalloc(f *Func) {
                                // Update v.
                                v.SetArg(i, c)
                                // Remember the most-recently computed flag value.
-                               flag = c
+                               flag = a
                        }
                        // Issue v.
                        b.Values = append(b.Values, v)
@@ -110,7 +110,7 @@ func flagalloc(f *Func) {
                        // Recalculate control value.
                        c := v.copyInto(b)
                        b.Control = c
-                       flag = c
+                       flag = v
                }
                if v := end[b.ID]; v != nil && v != flag {
                        // Need to reissue flag generator for use by