[go] cmd/compile: disable inlining for functions using runtime.deferrangefunc

0 views
Skip to first unread message

Cherry Mui (Gerrit)

unread,
Dec 30, 2025, 10:26:40 AM (2 days ago) 12/30/25
to 俊伟左, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, David Chase, Go LUCI, Wayne Zuo, Keith Randall, golang-co...@googlegroups.com

Cherry Mui submitted the change

Change information

Commit message:
cmd/compile: disable inlining for functions using runtime.deferrangefunc

The rangefunc rewrite pass implements defer using deferrangefunc and
deferproccat. The loop body is rewritten into a closure, it cannot be
inlined due to defer call. But the outer function may still be inlined
in certain scenarios (e.g., with PGO), leading to the defer executing
at the wrong time.

Fixes #77033
Change-Id: I4649fad5cd1b65891832523522002d9352711123
Reviewed-by: David Chase <drc...@google.com>
Reviewed-by: Cherry Mui <cher...@google.com>
Files:
  • M src/cmd/compile/internal/inline/inl.go
  • A src/cmd/compile/testdata/script/issue77033.txt
Change size: S
Delta: 2 files changed, 43 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Cherry Mui, +2 by David Chase
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4649fad5cd1b65891832523522002d9352711123
Gerrit-Change-Number: 732140
Gerrit-PatchSet: 4
Gerrit-Owner: 俊伟左 <zuojunw...@bytedance.com>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Wayne Zuo <wdvxd...@gmail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages