Commit daee726a authored by Cherry Zhang's avatar Cherry Zhang
Browse files

cmd/compile: don't accumulate duplicated named slots

Currently, in expand_calls, for each appearance of a named
variables's component, we add the named slot to f.Names list. If
a variable appears many times, we add it to f.Names many times.
Furthure, for each duplicated named slot, its entry in
f.NamedValues is a slice that contains all Values associated with
that name. This leads to quadratic behavior when iterating named
values like

	for _, name := range f.Names {
		for _, v := range f.NamedValues[name] {
			...
		}
	}

This CL makes it not to add duplicated entries to f.Names.

Change-Id: I82a8d009db81ecf48b4577e0bca501feff677cdf
Reviewed-on: https://go-review.googlesource.com/c/go/+/312093


Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: default avatarDavid Chase <drchase@google.com>
Reviewed-by: default avatarThan McIntosh <thanm@google.com>
parent 4d56576e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment