]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/inline: fix latent CalleeEffects issue
authorMatthew Dempsky <mdempsky@google.com>
Mon, 8 Aug 2022 19:31:33 +0000 (12:31 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 9 Aug 2022 16:41:32 +0000 (16:41 +0000)
commit25d74f324dde687e1bbf486ef444a1f73f48f4eb
tree7b9156b130746c426bfb29dba1645bef7cf371e4
parentbd901af30bcc8b92c5ce708b5b7d6352b17b54e8
cmd/compile/internal/inline: fix latent CalleeEffects issue

ir.ClosureExpr implements ir.InitNode, so ir.InitExpr can prepend init
statements to it. However, CalleeEffects wasn't aware of this and
could cause the init statements to get dropped when inlining a call to
a closure.

This isn't an issue today, because we don't create closures with init
statements. But I ran into this within unified IR.

Easy and robust solution: just take advantage that ir.TakeInit can
handle any node.

Change-Id: Ica05fbf6a8c5be4b11927daf84491a1140da5431
Reviewed-on: https://go-review.googlesource.com/c/go/+/422196
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/inline/inl.go