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.
res := NewInline(n, fn, inlIndex)
if res == nil {
- res = oldInline(n, fn, inlIndex)
+ return n
}
// transitive inlining
pri, ok := bodyReader[fn]
if !ok {
- base.FatalfAt(call.Pos(), "missing function body for call to %v", fn)
+ // TODO(mdempsky): Reconsider this diagnostic's wording, if it's
+ // to be included in Go 1.20.
+ if base.Flag.LowerM != 0 {
+ base.WarnfAt(call.Pos(), "cannot inline call to %v: missing inline body", fn)
+ }
+ return nil
}
if fn.Inl.Body == nil {