aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline/inl.go
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-12-01 16:14:11 -0800
committerMatthew Dempsky <mdempsky@google.com>2023-01-25 21:16:32 +0000
commit4f467f10820e78add23bf5ddeb1de521aa6f8864 (patch)
treebbbec653b076376952b8375e234117e0057ed592 /src/cmd/compile/internal/inline/inl.go
parent3d49b683c6095a9a2681e84f05adfbb8d82882e8 (diff)
downloadgo-4f467f10820e78add23bf5ddeb1de521aa6f8864.tar.xz
cmd: remove GOEXPERIMENT=nounified knob
This CL removes the GOEXPERIMENT=nounified knob, and any conditional statements that depend on that knob. Further CLs to remove unreachable code follow this one. Updates #57410. Change-Id: I39c147e1a83601c73f8316a001705778fee64a91 Reviewed-on: https://go-review.googlesource.com/c/go/+/458615 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/inline/inl.go')
-rw-r--r--src/cmd/compile/internal/inline/inl.go59
1 files changed, 7 insertions, 52 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index e3b2e44f61..de25d451eb 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -645,15 +645,13 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
// minimize impact to the existing inlining heuristics (in
// particular, to avoid breaking the existing inlinability regress
// tests), we need to compensate for this here.
- if base.Debug.Unified != 0 {
- if init := n.Rhs[0].Init(); len(init) == 1 {
- if _, ok := init[0].(*ir.AssignListStmt); ok {
- // 4 for each value, because each temporary variable now
- // appears 3 times (DCL, LHS, RHS), plus an extra DCL node.
- //
- // 1 for the extra "tmp1, tmp2 = f()" assignment statement.
- v.budget += 4*int32(len(n.Lhs)) + 1
- }
+ if init := n.Rhs[0].Init(); len(init) == 1 {
+ if _, ok := init[0].(*ir.AssignListStmt); ok {
+ // 4 for each value, because each temporary variable now
+ // appears 3 times (DCL, LHS, RHS), plus an extra DCL node.
+ //
+ // 1 for the extra "tmp1, tmp2 = f()" assignment statement.
+ v.budget += 4*int32(len(n.Lhs)) + 1
}
}
@@ -958,49 +956,6 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlCalls *[]*ir.Inlin
return n
}
- // The non-unified frontend has issues with inlining and shape parameters.
- if base.Debug.Unified == 0 {
- // Don't inline a function fn that has no shape parameters, but is passed at
- // least one shape arg. This means we must be inlining a non-generic function
- // fn that was passed into a generic function, and can be called with a shape
- // arg because it matches an appropriate type parameters. But fn may include
- // an interface conversion (that may be applied to a shape arg) that was not
- // apparent when we first created the instantiation of the generic function.
- // We can't handle this if we actually do the inlining, since we want to know
- // all interface conversions immediately after stenciling. So, we avoid
- // inlining in this case, see issue #49309. (1)
- //
- // See discussion on go.dev/cl/406475 for more background.
- if !fn.Type().Params().HasShape() {
- for _, arg := range n.Args {
- if arg.Type().HasShape() {
- if logopt.Enabled() {
- logopt.LogOpt(n.Pos(), "cannotInlineCall", "inline", ir.FuncName(ir.CurFunc),
- fmt.Sprintf("inlining function %v has no-shape params with shape args", ir.FuncName(fn)))
- }
- return n
- }
- }
- } else {
- // Don't inline a function fn that has shape parameters, but is passed no shape arg.
- // See comments (1) above, and issue #51909.
- inlineable := len(n.Args) == 0 // Function has shape in type, with no arguments can always be inlined.
- for _, arg := range n.Args {
- if arg.Type().HasShape() {
- inlineable = true
- break
- }
- }
- if !inlineable {
- if logopt.Enabled() {
- logopt.LogOpt(n.Pos(), "cannotInlineCall", "inline", ir.FuncName(ir.CurFunc),
- fmt.Sprintf("inlining function %v has shape params with no-shape args", ir.FuncName(fn)))
- }
- return n
- }
- }
- }
-
if base.Flag.Cfg.Instrumenting && types.IsRuntimePkg(fn.Sym().Pkg) {
// Runtime package must not be instrumented.
// Instrument skips runtime package. However, some runtime code can be