]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: cleanup for concrete types - range, select, swt
authorRuss Cox <rsc@golang.org>
Thu, 10 Dec 2020 23:47:32 +0000 (18:47 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 17 Dec 2020 04:43:34 +0000 (04:43 +0000)
commitdd67b13d07e6324c2b6d3330515c1f1e49fe5a9b
treeef07822b8b5e81c9e020e54b3458e9200e79cc28
parent42fec2ded44a1bedf739dbc2b33f1b144616ec4c
[dev.regabi] cmd/compile: cleanup for concrete types - range, select, swt

An automated rewrite will add concrete type assertions after
a test of n.Op(), when n can be safely type-asserted
(meaning, n is not reassigned a different type, n is not reassigned
and then used outside the scope of the type assertion,
and so on).

This sequence of CLs handles the code that the automated
rewrite does not: adding specific types to function arguments,
adjusting code not to call n.Left() etc when n may have multiple
representations, and so on.

This CL focuses on range.go, select.go, and swt.go: the big
control structures.

Passes buildall w/ toolstash -cmp.

Change-Id: I033fe056a7b815edb6e8a06f45c12ffd990f4d45
Reviewed-on: https://go-review.googlesource.com/c/go/+/277929
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/select.go
src/cmd/compile/internal/gc/swt.go
src/cmd/compile/internal/gc/walk.go