aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline
diff options
context:
space:
mode:
authorDan Scales <danscales@google.com>2021-02-25 12:13:23 -0800
committerDan Scales <danscales@google.com>2021-02-26 02:11:50 +0000
commit9a555fc24c318bf1b07bdc07d5c02e372681e401 (patch)
treedd079c4e836413524928a567b1b7503dccd0e68b /src/cmd/compile/internal/inline
parenta61524d1033632f733f69bf6635e767d70d95cdd (diff)
downloadgo-9a555fc24c318bf1b07bdc07d5c02e372681e401.tar.gz
go-9a555fc24c318bf1b07bdc07d5c02e372681e401.zip
cmd/compile: fix missing descend in Addrtaken for closures.
ComputeAddrtaken needs to descend into closures, now that imported bodies can include closures. The bug was that we weren't properly setting Addrtaken for a variable inside a closure inside a function that we were importing. For now, still disable inlining of functions with closures for -G mode. I'll enable it in a later change -- there are just a few fixes related to the fact that we don't need to set Ntype for closure functions. Added a test derived from the cilium repro in the issue. Fixes #44370 Change-Id: Ida2a403636bf8740b471b3ad68b5474951811e19 Reviewed-on: https://go-review.googlesource.com/c/go/+/296649 Run-TryBot: Dan Scales <danscales@google.com> Trust: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r--src/cmd/compile/internal/inline/inl.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index 1703be74e9..e961b10844 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -354,9 +354,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
return true
case ir.OCLOSURE:
- if base.Debug.InlFuncsWithClosures == 0 {
- // TODO(danscales): change default of InlFuncsWithClosures
- // to 1 when #44370 is fixed
+ if base.Debug.InlFuncsWithClosures == 0 || base.Flag.G > 0 {
v.reason = "not inlining functions with closures"
return true
}