From: Josh Bleecher Snyder Date: Sat, 7 Mar 2020 21:53:15 +0000 (-0800) Subject: cmd/compile: rename a local variable in shortcircuitBlock X-Git-Tag: go1.15beta1~867 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=74bc90a9a86365ca158a2d4e8697b0f4650e31c5;p=gostls13.git cmd/compile: rename a local variable in shortcircuitBlock 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 TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/shortcircuit.go b/src/cmd/compile/internal/ssa/shortcircuit.go index bb2322e28a..42b0639cae 100644 --- a/src/cmd/compile/internal/ssa/shortcircuit.go +++ b/src/cmd/compile/internal/ssa/shortcircuit.go @@ -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 }