diff options
author | Dan Scales <danscales@google.com> | 2021-02-24 13:03:17 -0800 |
---|---|---|
committer | Dan Scales <danscales@google.com> | 2021-02-24 21:34:21 +0000 |
commit | 8027343b6395536aa8bef8158bad8f4c290dd650 (patch) | |
tree | 836afccdd9c0826eea60c9a3e0e43b2367e119b3 /src/cmd/compile/internal/inline | |
parent | 6c3f8a2f4730f005850be7fde3a3dac6dc5323a6 (diff) | |
download | go-8027343b6395536aa8bef8158bad8f4c290dd650.tar.gz go-8027343b6395536aa8bef8158bad8f4c290dd650.zip |
cmd/compile: disable inlining functions with closures for now
Added a flag '-d=inlfuncswithclosures=1' to allow inlining functions with
closures, and change the default to off for now, until #44370 is fixed.
Updates #44370.
Change-Id: Ic17723aa5c091d91f5f5004d8b63ec7125257acf
Reviewed-on: https://go-review.googlesource.com/c/go/+/296049
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r-- | src/cmd/compile/internal/inline/inl.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index 0e57c17667..fe6509e4c9 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -354,15 +354,15 @@ func (v *hairyVisitor) doNode(n ir.Node) bool { return true case ir.OCLOSURE: - // TODO(danscales,mdempsky): Get working with -G. - // Probably after #43818 is fixed. - if base.Flag.G > 0 { - v.reason = "inlining closures not yet working with -G" + if base.Debug.InlFuncsWithClosures == 0 { + // TODO(danscales): change default of InlFuncsWithClosures + // to 1 when #44370 is fixed + v.reason = "not inlining functions with closures" return true } - // TODO(danscales) - fix some bugs when budget is lowered below 15 - // Maybe make budget proportional to number of closure variables, e.g.: + // TODO(danscales): Maybe make budget proportional to number of closure + // variables, e.g.: //v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3) v.budget -= 15 // Scan body of closure (which DoChildren doesn't automatically |