aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/inline
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-07-25 21:37:30 -0700
committerMatthew Dempsky <mdempsky@google.com>2022-07-28 07:31:42 +0000
commitf2851c67fd103b8dd7e84e3d35b896ea49ea4af5 (patch)
tree4779df24639af68bbbacfb569c2d0e1caa518b56 /src/cmd/compile/internal/inline
parent831fdf1dff5e38c6c23922880d97ac99fe30f311 (diff)
downloadgo-f2851c67fd103b8dd7e84e3d35b896ea49ea4af5.tar.xz
[dev.unified] cmd/compile: allow inlining to fail gracefully
Change-Id: I20c7df52d110fb88eb22d57bdad9264d0c5e22fe Reviewed-on: https://go-review.googlesource.com/c/go/+/419674 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/inline')
-rw-r--r--src/cmd/compile/internal/inline/inl.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index b6f80a1723..77848577c6 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -685,9 +685,8 @@ var inlgen int
var SSADumpInline = func(*ir.Func) {}
// NewInline allows the inliner implementation to be overridden.
-// If it returns nil, the legacy inliner will handle this call
-// instead.
-var NewInline = func(call *ir.CallExpr, fn *ir.Func, inlIndex int) *ir.InlinedCallExpr { return nil }
+// If it returns nil, the function will not be inlined.
+var NewInline = oldInline
// If n is a OCALLFUNC node, and fn is an ONAME node for a
// function with an inlinable body, return an OINLCALL node that can replace n.
@@ -807,7 +806,7 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlMap map[*ir.Func]b
res := NewInline(n, fn, inlIndex)
if res == nil {
- res = oldInline(n, fn, inlIndex)
+ return n
}
// transitive inlining