cmd/compile: optimize types.sconv

Now that symfmt is simpler, we can simply manually inline it into
sconv. Importantly, this allows us to avoid allocating a buffer +
writing a string + re-interning it when we don't need to qualify the
identifier.

Passes toolstash -cmp.

Updates #47087.

Change-Id: I47b57aef22301ba242556a645346f478f0c1a7d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/333162
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/src/cmd/compile/internal/types/fmt.go b/src/cmd/compile/internal/types/fmt.go
index 0ce423d..7b284aa 100644
--- a/src/cmd/compile/internal/types/fmt.go
+++ b/src/cmd/compile/internal/types/fmt.go
@@ -112,11 +112,19 @@
 	if s.Name == "_" {
 		return "_"
 	}
+
+	q := pkgqual(s.Pkg, verb, mode)
+	if q == "" {
+		return s.Name
+	}
+
 	buf := fmtBufferPool.Get().(*bytes.Buffer)
 	buf.Reset()
 	defer fmtBufferPool.Put(buf)
 
-	symfmt(buf, s, verb, mode)
+	buf.WriteString(q)
+	buf.WriteByte('.')
+	buf.WriteString(s.Name)
 	return InternString(buf.Bytes())
 }