]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] cmd/compile/internal/inline: fix latent CalleeEffects issue
authorMatthew Dempsky <mdempsky@google.com>
Mon, 8 Aug 2022 19:31:33 +0000 (12:31 -0700)
committerCherry Mui <cherryyz@google.com>
Mon, 19 Sep 2022 21:52:38 +0000 (21:52 +0000)
commitd5a5db3b41e45a1c5ec39a1a8f91d863e9e7770d
treea26adc2c078ca4ea4c0b6526eecce2f82ec37350
parent31d06b58fa2448c8e98ac78a97cc9a52dc2aa035
[release-branch.go1.18] 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.

Fixes #54918.

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>
Reviewed-on: https://go-review.googlesource.com/c/go/+/429897
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/cmd/compile/internal/inline/inl.go
test/typeparam/issue54911.go [new file with mode: 0644]