]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: simplify a few bits of the code
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 28 Sep 2017 19:17:59 +0000 (20:17 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 28 Sep 2017 20:40:17 +0000 (20:40 +0000)
Remove an unused type, a few redundant returns and replace a few slice
append loops with a single append.

Change-Id: If07248180bae5631b5b152c6051d9635889997d5
Reviewed-on: https://go-review.googlesource.com/66851
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/ssa/loopreschedchecks.go
src/cmd/compile/internal/ssa/regalloc.go

index e65e7f62806d1b8d64ddc0cbedcb1eb192eb1476..a009f2b6bfd58e5e3bbc540563fde06dca56b662 100644 (file)
@@ -663,9 +663,7 @@ func (p *exporter) typ(t *types.Type) {
                // TODO(gri) Determine if they are already sorted
                // in which case we can drop this step.
                var methods []*types.Field
-               for _, m := range t.Methods().Slice() {
-                       methods = append(methods, m)
-               }
+               methods = append(methods, t.Methods().Slice()...)
                sort.Sort(methodbyname(methods))
                p.int(len(methods))
 
index 10be25b1261245a9b50f0ba386827447976ae134..3d3899d3c6f698c33e9b47953d5ec2b186eb6f48 100644 (file)
@@ -157,7 +157,6 @@ func init1(n *Node, out *[]*Node) {
        initlist = initlist[:last]
 
        n.SetInitorder(InitDone)
-       return
 }
 
 // foundinitloop prints an init loop error and exits.
index 3f14b9340c1720a1b37af1b507c3ded925ab0dca..523007f3b6b455c03e3c4a85781f48d378110fb2 100644 (file)
@@ -3789,7 +3789,6 @@ ret:
 
        lineno = lno
        n.SetWalkdef(1)
-       return
 }
 
 func checkmake(t *types.Type, arg string, n *Node) bool {
index e8168bdc2b359a893c966e344bee058c37071876..c9c04ef41ce307bf533e9344fe12c6d72e5171b2 100644 (file)
@@ -267,8 +267,6 @@ func insertLoopReschedChecks(f *Func) {
                sdom = newSparseTree(f, f.Idom())
                fmt.Printf("after %s = %s\n", f.Name, sdom.treestructure(f.Entry))
        }
-
-       return
 }
 
 // newPhiFor inserts a new Phi function into b,
index 1420a564f1f57ec7d4f79d431b5193a8c0f5dcdd..25d8f484ab5d58ffdc967b388dbf8a691e9dca5a 100644 (file)
@@ -1715,14 +1715,10 @@ func (s *regAllocState) placeSpills() {
                }
                oldSched = append(oldSched[:0], b.Values[nphi:]...)
                b.Values = b.Values[:nphi]
-               for _, v := range start[b.ID] {
-                       b.Values = append(b.Values, v)
-               }
+               b.Values = append(b.Values, start[b.ID]...)
                for _, v := range oldSched {
                        b.Values = append(b.Values, v)
-                       for _, w := range after[v.ID] {
-                               b.Values = append(b.Values, w)
-                       }
+                       b.Values = append(b.Values, after[v.ID]...)
                }
        }
 }
@@ -2211,12 +2207,6 @@ type liveInfo struct {
        pos  src.XPos // source position of next use
 }
 
-// dblock contains information about desired & avoid registers at the end of a block.
-type dblock struct {
-       prefers []desiredStateEntry
-       avoid   regMask
-}
-
 // computeLive computes a map from block ID to a list of value IDs live at the end
 // of that block. Together with the value ID is a count of how many instructions
 // to the next use of that value. The resulting map is stored in s.live.