From 2380862c7c05666f9bfe799fb1222cb4e5631541 Mon Sep 17 00:00:00 2001 From: David Chase Date: Thu, 9 Nov 2023 11:43:13 -0500 Subject: [PATCH] cmd/compile: small inlining tweak for range-func panics treat the panic, like a panic. It helps with inlining, and thus reduced closure allocation and performance, for many examples of function range iterators. Change-Id: Ib1a656cdfa56eb2dee400089c4c94ac14f1d2104 Reviewed-on: https://go-review.googlesource.com/c/go/+/541235 Run-TryBot: David Chase Reviewed-by: Matthew Dempsky TryBot-Result: Gopher Robot --- src/cmd/compile/internal/inline/inl.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go index c2d3effd65..4009b776ea 100644 --- a/src/cmd/compile/internal/inline/inl.go +++ b/src/cmd/compile/internal/inline/inl.go @@ -528,6 +528,8 @@ opSwitch: case "throw": v.budget -= inlineExtraThrowCost break opSwitch + case "panicrangeexit": + cheap = true } // Special case for reflect.noescape. It does just type // conversions to appease the escape analysis, and doesn't -- 2.50.0