diff options
author | Russ Cox <rsc@golang.org> | 2020-12-10 18:48:33 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-12-17 04:43:53 +0000 |
commit | 9c384e881e28d322b854ac702ce8f052868f5f41 (patch) | |
tree | 4a066b7c256bc8814818a8272ec4f3546bfd66cd /src/cmd/compile/internal/gc/main.go | |
parent | be64c8becebace2304e6c16408f6988d1da55900 (diff) | |
download | go-9c384e881e28d322b854ac702ce8f052868f5f41.tar.gz go-9c384e881e28d322b854ac702ce8f052868f5f41.zip |
[dev.regabi] cmd/compile: cleanup for concrete types - mop-up
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 handles all the little files that are left.
Passes buildall w/ toolstash -cmp.
Change-Id: I6588c92dbbdd37342a77b365d70e02134a033d2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/277932
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/main.go')
-rw-r--r-- | src/cmd/compile/internal/gc/main.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go index 77b11c5d5d..03e787f718 100644 --- a/src/cmd/compile/internal/gc/main.go +++ b/src/cmd/compile/internal/gc/main.go @@ -244,7 +244,7 @@ func Main(archInit func(*Arch)) { timings.Start("fe", "typecheck", "top1") for i := 0; i < len(xtop); i++ { n := xtop[i] - if op := n.Op(); op != ir.ODCL && op != ir.OAS && op != ir.OAS2 && (op != ir.ODCLTYPE || !n.Left().Name().Alias()) { + if op := n.Op(); op != ir.ODCL && op != ir.OAS && op != ir.OAS2 && (op != ir.ODCLTYPE || !n.(*ir.Decl).Left().Name().Alias()) { xtop[i] = typecheck(n, ctxStmt) } } @@ -256,7 +256,7 @@ func Main(archInit func(*Arch)) { timings.Start("fe", "typecheck", "top2") for i := 0; i < len(xtop); i++ { n := xtop[i] - if op := n.Op(); op == ir.ODCL || op == ir.OAS || op == ir.OAS2 || op == ir.ODCLTYPE && n.Left().Name().Alias() { + if op := n.Op(); op == ir.ODCL || op == ir.OAS || op == ir.OAS2 || op == ir.ODCLTYPE && n.(*ir.Decl).Left().Name().Alias() { xtop[i] = typecheck(n, ctxStmt) } } |