cmd/compile: reduce garbage from autolabel

Follow-up to CL 26661

Change-Id: I67c58d17313094675cf0f30ce50d486818ae0dcb
Reviewed-on: https://go-review.googlesource.com/27113
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/src/cmd/compile/internal/gc/inl.go b/src/cmd/compile/internal/gc/inl.go
index ea49ae1..a669df8 100644
--- a/src/cmd/compile/internal/gc/inl.go
+++ b/src/cmd/compile/internal/gc/inl.go
@@ -766,7 +766,7 @@
 		ninit.Append(as)
 	}
 
-	retlabel := autolabel("i")
+	retlabel := autolabel(".i")
 	retlabel.Etype = 1 // flag 'safe' for escape analysis (no backjumps)
 
 	inlgen++
diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go
index fa4c8e8..c3f2b60 100644
--- a/src/cmd/compile/internal/gc/subr.go
+++ b/src/cmd/compile/internal/gc/subr.go
@@ -248,16 +248,21 @@
 
 // autolabel generates a new Name node for use with
 // an automatically generated label.
-// prefix is a short mnemonic (e.g. "s" for switch)
+// prefix is a short mnemonic (e.g. ".s" for switch)
 // to help with debugging.
+// It should begin with "." to avoid conflicts with
+// user labels.
 func autolabel(prefix string) *Node {
+	if prefix[0] != '.' {
+		Fatalf("autolabel prefix must start with '.', have %q", prefix)
+	}
 	fn := Curfn
 	if Curfn == nil {
 		Fatalf("autolabel outside function")
 	}
 	n := fn.Func.Label
 	fn.Func.Label++
-	return newname(LookupN("."+prefix, int(n)))
+	return newname(LookupN(prefix, int(n)))
 }
 
 var initSyms []*Sym
diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go
index dce3e16..f44c747 100644
--- a/src/cmd/compile/internal/gc/swt.go
+++ b/src/cmd/compile/internal/gc/swt.go
@@ -358,7 +358,7 @@
 		n.Op = OCASE
 		needvar := n.List.Len() != 1 || n.List.First().Op == OLITERAL
 
-		jmp := Nod(OGOTO, autolabel("s"), nil)
+		jmp := Nod(OGOTO, autolabel(".s"), nil)
 		if n.List.Len() == 0 {
 			if def != nil {
 				Yyerror("more than one default case")
@@ -577,7 +577,7 @@
 		i.Nbody.Set1(typenil)
 	} else {
 		// Jump to default case.
-		lbl := autolabel("s")
+		lbl := autolabel(".s")
 		i.Nbody.Set1(Nod(OGOTO, lbl, nil))
 		// Wrap default case with label.
 		blk := Nod(OBLOCK, nil, nil)