aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-09-24 09:13:32 -0700
committerDan Scales <danscales@google.com>2021-09-24 18:11:24 +0000
commit812c99f86a1b38d50c5c0b501d10b72c3b7dfb95 (patch)
tree481248b127632b1a03d0944a3a524eca6fc10827 /src/cmd/compile/internal/noder
parentb00222fcdd9f2aeb426887b005865eca1aec3631 (diff)
downloadgo-812c99f86a1b38d50c5c0b501d10b72c3b7dfb95.tar.xz
cmd/compile: fix case in dictPass where OMETHVALUE should become ODOTMETH
When I separate out the dictionary transformations to dictPass, I missed duplicating a conditional that deals with OMETHVALUE nodes that are actually called. We create the OMETHVALUE when transforming bounds function reference (before we know whether that reference will be called), and we need to call transformDot() again to convert the OMETHVALUE to ODOTMETH if the reference is actually called (the usual case). Without this change, we leave the OMETHVALUE in, and extra *-fm are created and used unncessarily. Also, fixed a few places where we were missing ir.MarkFunc(), which sets the class of a function node properly. Change-Id: I6b02613039b16b507b44525faa2cd7031afb6982 Reviewed-on: https://go-review.googlesource.com/c/go/+/352069 Trust: Dan Scales <danscales@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/noder')
-rw-r--r--src/cmd/compile/internal/noder/stencil.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index c8ce230121..cf8641d60e 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -1220,6 +1220,12 @@ func (g *irgen) dictPass(info *instInfo) {
op := m.(*ir.CallExpr).X.Op()
if op != ir.OFUNCINST {
assert(op == ir.OMETHVALUE || op == ir.OCLOSURE || op == ir.ODYNAMICDOTTYPE || op == ir.ODYNAMICDOTTYPE2)
+ if op == ir.OMETHVALUE {
+ // Redo the transformation of OXDOT, now that we
+ // know the method value is being called.
+ m.(*ir.CallExpr).X.(*ir.SelectorExpr).SetOp(ir.OXDOT)
+ transformDot(m.(*ir.CallExpr).X.(*ir.SelectorExpr), true)
+ }
transformCall(m.(*ir.CallExpr))
}