[dev.cc] cmd/5g etc: code cleanup: delay var decls and eliminate dead code

Ran rsc.io/grind rev 6f0e601 on the source files.

The cleanups move var declarations as close to the use
as possible, splitting disjoint uses of the var into separate
variables. They also remove dead code (especially in
func sudoaddable), which helps with the var moving.

There's more cleanup to come, but this alone cuts the
time spent compiling html/template on my 2013 MacBook Pro
from 3.1 seconds to 2.3 seconds.

Change-Id: I4de499f47b1dd47a560c310bbcde6b08d425cfd6
Reviewed-on: https://go-review.googlesource.com/5637
Reviewed-by: Rob Pike <r@golang.org>
diff --git a/src/cmd/internal/obj/ld.go b/src/cmd/internal/obj/ld.go
index 99cf64a..4d2e429 100644
--- a/src/cmd/internal/obj/ld.go
+++ b/src/cmd/internal/obj/ld.go
@@ -44,13 +44,11 @@
 )
 
 func mkfwd(sym *LSym) {
-	var p *Prog
-	var i int
 	var dwn [LOG]int32
 	var cnt [LOG]int32
 	var lst [LOG]*Prog
 
-	for i = 0; i < LOG; i++ {
+	for i := 0; i < LOG; i++ {
 		if i == 0 {
 			cnt[i] = 1
 		} else {
@@ -60,8 +58,8 @@
 		lst[i] = nil
 	}
 
-	i = 0
-	for p = sym.Text; p != nil && p.Link != nil; p = p.Link {
+	i := 0
+	for p := sym.Text; p != nil && p.Link != nil; p = p.Link {
 		i--
 		if i < 0 {
 			i = LOG - 1
@@ -79,17 +77,13 @@
 }
 
 func Copyp(ctxt *Link, q *Prog) *Prog {
-	var p *Prog
-
-	p = ctxt.NewProg()
+	p := ctxt.NewProg()
 	*p = *q
 	return p
 }
 
 func Appendp(ctxt *Link, q *Prog) *Prog {
-	var p *Prog
-
-	p = ctxt.NewProg()
+	p := ctxt.NewProg()
 	p.Link = q.Link
 	q.Link = p
 	p.Lineno = q.Lineno