]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: rename a local variable in shortcircuitBlock
authorJosh Bleecher Snyder <josharian@gmail.com>
Sat, 7 Mar 2020 21:53:15 +0000 (13:53 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 13 Mar 2020 19:41:40 +0000 (19:41 +0000)
v is pretty generic. Subsequent changes will make this function
more complicated, so rename it now, independently, for easier review.

v is the control value for the block (or its underlying phi);
call it ctl.

Passes toolstash-check.

Updates #37608

Change-Id: I3fbae3344f1c95aff0a69c1e4f61ef637a54774e
Reviewed-on: https://go-review.googlesource.com/c/go/+/222917
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/shortcircuit.go

index bb2322e28a3c2f3a65abb0acd7aa8ad4418245bc..42b0639caea9358277aaf3fe939d1280fec3f466 100644 (file)
@@ -103,24 +103,24 @@ func shortcircuitBlock(b *Block) bool {
        // Look for control values of the form Copy(Not(Copy(Phi(const, ...)))).
        // Those must be the only values in the b, and they each must be used only by b.
        // Track the negations so that we can swap successors as needed later.
-       v := b.Controls[0]
+       ctl := b.Controls[0]
        nval := 1 // the control value
        swap := false
-       for v.Uses == 1 && v.Block == b && (v.Op == OpCopy || v.Op == OpNot) {
-               if v.Op == OpNot {
+       for ctl.Uses == 1 && ctl.Block == b && (ctl.Op == OpCopy || ctl.Op == OpNot) {
+               if ctl.Op == OpNot {
                        swap = !swap
                }
-               v = v.Args[0]
+               ctl = ctl.Args[0]
                nval++ // wrapper around control value
        }
-       if len(b.Values) != nval || v.Op != OpPhi || v.Block != b || v.Uses != 1 {
+       if len(b.Values) != nval || ctl.Op != OpPhi || ctl.Block != b || ctl.Uses != 1 {
                return false
        }
 
        // Check for const phi args.
        var changed bool
-       for i := 0; i < len(v.Args); i++ {
-               a := v.Args[i]
+       for i := 0; i < len(ctl.Args); i++ {
+               a := ctl.Args[i]
                if a.Op != OpConstBool {
                        continue
                }
@@ -149,10 +149,10 @@ func shortcircuitBlock(b *Block) bool {
                // Remove b's incoming edge from p.
                b.removePred(i)
                n := len(b.Preds)
-               v.Args[i].Uses--
-               v.Args[i] = v.Args[n]
-               v.Args[n] = nil
-               v.Args = v.Args[:n]
+               ctl.Args[i].Uses--
+               ctl.Args[i] = ctl.Args[n]
+               ctl.Args[n] = nil
+               ctl.Args = ctl.Args[:n]
 
                // Redirect p's outgoing edge to t.
                p.Succs[pi] = Edge{t, len(t.Preds)}
@@ -178,6 +178,6 @@ func shortcircuitBlock(b *Block) bool {
                return true
        }
 
-       phielimValue(v)
+       phielimValue(ctl)
        return true
 }