]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: small inlining tweak for range-func panics
authorDavid Chase <drchase@google.com>
Thu, 9 Nov 2023 16:43:13 +0000 (11:43 -0500)
committerDavid Chase <drchase@google.com>
Wed, 15 Nov 2023 20:08:10 +0000 (20:08 +0000)
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 <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/compile/internal/inline/inl.go

index c2d3effd656fd8ebfbf80a802e75193ce0d96e11..4009b776ea6495ec8704b4a0dca570bd9d227654 100644 (file)
@@ -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