[go] cmd/compile: ensure bloop only kept alive addressable nodes

4 views
Skip to first unread message

Cuong Manh Le (Gerrit)

unread,
Dec 1, 2025, 4:55:53 AM (2 days ago) Dec 1
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Cuong Manh Le has uploaded the change for review

Commit message

cmd/compile: ensure bloop only kept alive addressable nodes

Fixes #76636
Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790

Change diff

diff --git a/src/cmd/compile/internal/bloop/bloop.go b/src/cmd/compile/internal/bloop/bloop.go
index 761b07a..e8ab9b3 100644
--- a/src/cmd/compile/internal/bloop/bloop.go
+++ b/src/cmd/compile/internal/bloop/bloop.go
@@ -45,7 +45,7 @@
"cmd/internal/src"
)

-// getNameFromNode tries to iteratively peel down the node to
+// getAddressableNameFromNode tries to iteratively peel down the node to
// get the name.
func getNameFromNode(n ir.Node) *ir.Name {
// Tries to iteratively peel down the node to get the names.
@@ -73,6 +73,14 @@
return nil
}

+// getAddressableNameFromNode is like getNameFromNode but returns nil if the node is not addressable.
+func getAddressableNameFromNode(n ir.Node) *ir.Name {
+ if name := getNameFromNode(n); name != nil && ir.IsAddressable(name) {
+ return name
+ }
+ return nil
+}
+
// keepAliveAt returns a statement that is either curNode, or a
// block containing curNode followed by a call to runtime.KeepAlive for each
// node in ns. These calls ensure that nodes in ns will be live until
@@ -94,6 +102,9 @@
if n.Sym().IsBlank() {
continue
}
+ if !ir.IsAddressable(n) {
+ base.FatalfAt(n.Pos(), "keepAliveAt: node %v is not addressable", n)
+ }
arg := ir.NewConvExpr(pos, ir.OCONV, types.Types[types.TUNSAFEPTR], typecheck.NodAddr(n))
if !n.Type().IsInterface() {
srcRType0 := reflectdata.TypePtrAt(pos, n.Type())
@@ -129,7 +140,7 @@
switch n := stmt.(type) {
case *ir.AssignStmt:
// Peel down struct and slice indexing to get the names
- name := getNameFromNode(n.X)
+ name := getAddressableNameFromNode(n.X)
if name != nil {
debugName(name, n.Pos())
ret = keepAliveAt([]ir.Node{name}, n)
@@ -144,7 +155,7 @@
case *ir.AssignListStmt:
ns := []ir.Node{}
for _, lhs := range n.Lhs {
- name := getNameFromNode(lhs)
+ name := getAddressableNameFromNode(lhs)
if name != nil {
debugName(name, n.Pos())
ns = append(ns, name)
@@ -159,7 +170,7 @@
}
ret = keepAliveAt(ns, n)
case *ir.AssignOpStmt:
- name := getNameFromNode(n.X)
+ name := getAddressableNameFromNode(n.X)
if name != nil {
debugName(name, n.Pos())
ret = keepAliveAt([]ir.Node{name}, n)
@@ -206,7 +217,7 @@
argTmps := []ir.Node{}
names := []ir.Node{}
for i, a := range n.Args {
- if name := getNameFromNode(a); name != nil {
+ if name := getAddressableNameFromNode(a); name != nil {
// If they are name, keep them alive directly.
debugName(name, n.Pos())
names = append(names, name)
@@ -215,7 +226,7 @@
s := a.(*ir.CompLitExpr)
ns := []ir.Node{}
for i, elem := range s.List {
- if name := getNameFromNode(elem); name != nil {
+ if name := getAddressableNameFromNode(elem); name != nil {
debugName(name, n.Pos())
ns = append(ns, name)
} else {
diff --git a/test/bloop.go b/test/bloop.go
index fd22132..69ae8f3 100644
--- a/test/bloop.go
+++ b/test/bloop.go
@@ -25,6 +25,12 @@
something = x[0]
}

+func receiver(f func()) { // ERROR "can inline receiver" "f does not escape"
+ f()
+}
+
+func argument() {} // ERROR "can inline argument"
+
func test(b *testing.B, localsink, cond int) { // ERROR ".*"
for i := 0; i < b.N; i++ {
caninline(1) // ERROR "inlining call to caninline"
@@ -49,5 +55,7 @@
{
caninline(1) // ERROR "inlining call to caninline" "function result will be kept alive"
}
+
+ receiver(argument) // ERROR inlining call to receiver" "function arg will be kept alive"
}
}

Change information

Files:
  • M src/cmd/compile/internal/bloop/bloop.go
  • M test/bloop.go
Change size: S
Delta: 2 files changed, 25 insertions(+), 6 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
Gerrit-Change-Number: 725420
Gerrit-PatchSet: 1
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Cuong Manh Le (Gerrit)

unread,
Dec 1, 2025, 4:56:18 AM (2 days ago) Dec 1
to goph...@pubsubhelper.golang.org, Keith Randall, Junyang Shao, golang-co...@googlegroups.com
Attention needed from Junyang Shao and Keith Randall

Cuong Manh Le voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Junyang Shao
  • Keith Randall
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
Gerrit-Change-Number: 725420
Gerrit-PatchSet: 1
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Attention: Keith Randall <k...@golang.org>
Gerrit-Attention: Junyang Shao <shaoj...@google.com>
Gerrit-Comment-Date: Mon, 01 Dec 2025 09:56:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Junyang Shao (Gerrit)

unread,
Dec 1, 2025, 10:32:03 AM (2 days ago) Dec 1
to Cuong Manh Le, goph...@pubsubhelper.golang.org, Go LUCI, Keith Randall, golang-co...@googlegroups.com
Attention needed from Cuong Manh Le and Keith Randall

Junyang Shao voted and added 1 comment

Votes added by Junyang Shao

Code-Review+2

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Junyang Shao . resolved

Thank you! :D

Open in Gerrit

Related details

Attention is currently required from:
  • Cuong Manh Le
  • Keith Randall
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
Gerrit-Change-Number: 725420
Gerrit-PatchSet: 1
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Attention: Keith Randall <k...@golang.org>
Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Comment-Date: Mon, 01 Dec 2025 15:31:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Junyang Shao (Gerrit)

unread,
Dec 1, 2025, 11:00:19 AM (2 days ago) Dec 1
to Cuong Manh Le, goph...@pubsubhelper.golang.org, Go LUCI, Keith Randall, golang-co...@googlegroups.com
Attention needed from Cuong Manh Le and Keith Randall

Junyang Shao added 1 comment

Patchset-level comments
Junyang Shao . unresolved

For non-addressable names, could it be useful to be kept alive?

The specific case your comment in CL 725180 mentioned is a global, which I believe DSE won't be able to remove reference of it, so not keeping it alive is right.

But if there are cases that we want to keep them alive, maybe we can do a conversion to TINTER for them instead of TUNSAFEPTR to make it work?

Open in Gerrit

Related details

Attention is currently required from:
  • Cuong Manh Le
  • Keith Randall
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
Gerrit-Change-Number: 725420
Gerrit-PatchSet: 1
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Attention: Keith Randall <k...@golang.org>
Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Comment-Date: Mon, 01 Dec 2025 16:00:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Cuong Manh Le (Gerrit)

unread,
Dec 1, 2025, 11:12:09 AM (2 days ago) Dec 1
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Cuong Manh Le and Keith Randall

Cuong Manh Le uploaded new patchset

Cuong Manh Le uploaded patch set #2 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Cuong Manh Le
  • Keith Randall
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    Dec 1, 2025, 11:12:15 AM (2 days ago) Dec 1
    to goph...@pubsubhelper.golang.org, Junyang Shao, Go LUCI, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Keith Randall

    Cuong Manh Le voted

    Auto-Submit+1
    Commit-Queue+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 16:12:07 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    Dec 1, 2025, 11:21:57 AM (2 days ago) Dec 1
    to goph...@pubsubhelper.golang.org, Junyang Shao, Go LUCI, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Junyang Shao and Keith Randall

    Cuong Manh Le added 1 comment

    Patchset-level comments
    Junyang Shao . unresolved

    For non-addressable names, could it be useful to be kept alive?

    The specific case your comment in CL 725180 mentioned is a global, which I believe DSE won't be able to remove reference of it, so not keeping it alive is right.

    But if there are cases that we want to keep them alive, maybe we can do a conversion to TINTER for them instead of TUNSAFEPTR to make it work?

    Cuong Manh Le

    Hmm, isn't that copying it to a tmp, then keeping the tmp alive is enough?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Junyang Shao
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Attention: Junyang Shao <shaoj...@google.com>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 16:21:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Junyang Shao <shaoj...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Junyang Shao (Gerrit)

    unread,
    Dec 1, 2025, 11:25:07 AM (2 days ago) Dec 1
    to Cuong Manh Le, goph...@pubsubhelper.golang.org, Go LUCI, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Cuong Manh Le and Keith Randall

    Junyang Shao voted and added 1 comment

    Votes added by Junyang Shao

    Code-Review+2

    1 comment

    Patchset-level comments
    Junyang Shao . unresolved

    For non-addressable names, could it be useful to be kept alive?

    The specific case your comment in CL 725180 mentioned is a global, which I believe DSE won't be able to remove reference of it, so not keeping it alive is right.

    But if there are cases that we want to keep them alive, maybe we can do a conversion to TINTER for them instead of TUNSAFEPTR to make it work?

    Cuong Manh Le

    Hmm, isn't that copying it to a tmp, then keeping the tmp alive is enough?

    Junyang Shao

    Ohh yes, I forgot that for the call arg case there is a tmp fallback for name not found.

    I assume non-addressable names are impossible to be present in assignment lhs, but I am not 100% sure as I am not very familiar with the ir, feel free to close my comment.

    Thanks :D

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Cuong Manh Le
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 16:25:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Cuong Manh Le <cuong.m...@gmail.com>
    Comment-In-Reply-To: Junyang Shao <shaoj...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    Dec 1, 2025, 11:32:43 AM (2 days ago) Dec 1
    to goph...@pubsubhelper.golang.org, Junyang Shao, Go LUCI, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Keith Randall

    Cuong Manh Le added 1 comment

    Patchset-level comments
    File-level comment, Patchset 1:
    Junyang Shao . resolved

    For non-addressable names, could it be useful to be kept alive?

    The specific case your comment in CL 725180 mentioned is a global, which I believe DSE won't be able to remove reference of it, so not keeping it alive is right.

    But if there are cases that we want to keep them alive, maybe we can do a conversion to TINTER for them instead of TUNSAFEPTR to make it work?

    Cuong Manh Le

    Hmm, isn't that copying it to a tmp, then keeping the tmp alive is enough?

    Junyang Shao

    Ohh yes, I forgot that for the call arg case there is a tmp fallback for name not found.

    I assume non-addressable names are impossible to be present in assignment lhs, but I am not 100% sure as I am not very familiar with the ir, feel free to close my comment.

    Thanks :D

    Cuong Manh Le

    I assume non-addressable names are impossible to be present in assignment lhs

    It's true.

    Both types2 (*Checker.lhsVar) and typecheck (checkassign) ensure that only addressable names are present in the lhs of the assignment.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 16:32:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Keith Randall (Gerrit)

    unread,
    Dec 1, 2025, 11:38:23 AM (2 days ago) Dec 1
    to Cuong Manh Le, goph...@pubsubhelper.golang.org, Go LUCI, Junyang Shao, Keith Randall, golang-co...@googlegroups.com

    Keith Randall added 1 comment

    File src/cmd/compile/internal/bloop/bloop.go
    Line 56, Patchset 2 (Latest): return n.(*ir.Name)
    Keith Randall . unresolved

    getNameFromNode isn't used any more.
    Can we just leave the name as is, and put the additional condition in right here?

    ```
    name := n.(*ir.Name)
    if !ir.IsAddressable(name) {
    name = nil
    }
    return name
    ```
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Comment-Date: Mon, 01 Dec 2025 16:38:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    Dec 1, 2025, 7:07:47 PM (2 days ago) Dec 1
    to goph...@pubsubhelper.golang.org, Go LUCI, Junyang Shao, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Keith Randall

    Cuong Manh Le added 1 comment

    File src/cmd/compile/internal/bloop/bloop.go
    Line 56, Patchset 2 (Latest): return n.(*ir.Name)
    Keith Randall . unresolved

    getNameFromNode isn't used any more.
    Can we just leave the name as is, and put the additional condition in right here?

    ```
    name := n.(*ir.Name)
    if !ir.IsAddressable(name) {
    name = nil
    }
    return name
    ```
    Cuong Manh Le

    I also thought about this, but I’m afraid we wont catch all cases here, for example, all OCONV, OVONVNOP, OCONVIFACE below can return ONAME, too.

    That’s why I ended up with new entrypoint to catch ONAME, I think it would make things easier when bisecting needed. We can cleanup then when we are sure that nothing broken.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Comment-Date: Tue, 02 Dec 2025 00:07:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Keith Randall <k...@golang.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    Dec 2, 2025, 5:20:26 AM (22 hours ago) Dec 2
    to goph...@pubsubhelper.golang.org, Go LUCI, Junyang Shao, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Keith Randall

    Cuong Manh Le added 1 comment

    File src/cmd/compile/internal/bloop/bloop.go
    Line 56, Patchset 2 (Latest): return n.(*ir.Name)
    Keith Randall . unresolved

    getNameFromNode isn't used any more.
    Can we just leave the name as is, and put the additional condition in right here?

    ```
    name := n.(*ir.Name)
    if !ir.IsAddressable(name) {
    name = nil
    }
    return name
    ```
    Cuong Manh Le

    I also thought about this, but I’m afraid we wont catch all cases here, for example, all OCONV, OVONVNOP, OCONVIFACE below can return ONAME, too.

    That’s why I ended up with new entrypoint to catch ONAME, I think it would make things easier when bisecting needed. We can cleanup then when we are sure that nothing broken.

    Cuong Manh Le

    Hmm, further brainstorming, in case of `f(T(arg))`, what do we want to keep alive? It's `T(arg)` or `arg`?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Comment-Date: Tue, 02 Dec 2025 10:20:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Keith Randall <k...@golang.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Keith Randall (Gerrit)

    unread,
    Dec 2, 2025, 12:06:09 PM (16 hours ago) Dec 2
    to Cuong Manh Le, goph...@pubsubhelper.golang.org, Go LUCI, Junyang Shao, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Cuong Manh Le

    Keith Randall added 1 comment

    File src/cmd/compile/internal/bloop/bloop.go
    Line 56, Patchset 2 (Latest): return n.(*ir.Name)
    Keith Randall . unresolved

    getNameFromNode isn't used any more.
    Can we just leave the name as is, and put the additional condition in right here?

    ```
    name := n.(*ir.Name)
    if !ir.IsAddressable(name) {
    name = nil
    }
    return name
    ```
    Cuong Manh Le

    I also thought about this, but I’m afraid we wont catch all cases here, for example, all OCONV, OVONVNOP, OCONVIFACE below can return ONAME, too.

    That’s why I ended up with new entrypoint to catch ONAME, I think it would make things easier when bisecting needed. We can cleanup then when we are sure that nothing broken.

    Cuong Manh Le

    Hmm, further brainstorming, in case of `f(T(arg))`, what do we want to keep alive? It's `T(arg)` or `arg`?

    Keith Randall

    The spec for b.Loop says

     arguments to and results from function calls within the loop are kept alive, preventing the compiler from fully optimizing away the loop body

    That's not just outermost function calls, it is all calls. So both `T(arg)` and `arg` (and `f(T(arg))`) should be kept alive.

    (But not from function calls that might appear after inlining. Just the ones that are syntactically there in the source code.)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Cuong Manh Le
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Comment-Date: Tue, 02 Dec 2025 17:06:03 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    Dec 2, 2025, 7:27:37 PM (8 hours ago) Dec 2
    to goph...@pubsubhelper.golang.org, Go LUCI, Junyang Shao, Keith Randall, golang-co...@googlegroups.com
    Attention needed from Keith Randall

    Cuong Manh Le added 1 comment

    File src/cmd/compile/internal/bloop/bloop.go
    Line 56, Patchset 2 (Latest): return n.(*ir.Name)
    Keith Randall . unresolved

    getNameFromNode isn't used any more.
    Can we just leave the name as is, and put the additional condition in right here?

    ```
    name := n.(*ir.Name)
    if !ir.IsAddressable(name) {
    name = nil
    }
    return name
    ```
    Cuong Manh Le

    I also thought about this, but I’m afraid we wont catch all cases here, for example, all OCONV, OVONVNOP, OCONVIFACE below can return ONAME, too.

    That’s why I ended up with new entrypoint to catch ONAME, I think it would make things easier when bisecting needed. We can cleanup then when we are sure that nothing broken.

    Cuong Manh Le

    Hmm, further brainstorming, in case of `f(T(arg))`, what do we want to keep alive? It's `T(arg)` or `arg`?

    Keith Randall

    The spec for b.Loop says

     arguments to and results from function calls within the loop are kept alive, preventing the compiler from fully optimizing away the loop body

    That's not just outermost function calls, it is all calls. So both `T(arg)` and `arg` (and `f(T(arg))`) should be kept alive.

    (But not from function calls that might appear after inlining. Just the ones that are syntactically there in the source code.)

    Cuong Manh Le

    Hmm, then I think even before this CL, only arg will be kept alive when T(arg) is a argument of function call.

    Should we let this CL in to fix the ICE, then followup CL will fix the semantics.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Keith Randall
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Keith Randall <k...@golang.org>
    Gerrit-Comment-Date: Wed, 03 Dec 2025 00:27:29 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Keith Randall (Gerrit)

    unread,
    Dec 2, 2025, 7:56:44 PM (8 hours ago) Dec 2
    to Cuong Manh Le, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Junyang Shao, golang-co...@googlegroups.com
    Attention needed from Cuong Manh Le

    Keith Randall voted and added 1 comment

    Votes added by Keith Randall

    Code-Review+2

    1 comment

    File src/cmd/compile/internal/bloop/bloop.go
    Line 56, Patchset 2 (Latest): return n.(*ir.Name)
    Keith Randall . resolved

    getNameFromNode isn't used any more.
    Can we just leave the name as is, and put the additional condition in right here?

    ```
    name := n.(*ir.Name)
    if !ir.IsAddressable(name) {
    name = nil
    }
    return name
    ```
    Cuong Manh Le

    I also thought about this, but I’m afraid we wont catch all cases here, for example, all OCONV, OVONVNOP, OCONVIFACE below can return ONAME, too.

    That’s why I ended up with new entrypoint to catch ONAME, I think it would make things easier when bisecting needed. We can cleanup then when we are sure that nothing broken.

    Cuong Manh Le

    Hmm, further brainstorming, in case of `f(T(arg))`, what do we want to keep alive? It's `T(arg)` or `arg`?

    Keith Randall

    The spec for b.Loop says

     arguments to and results from function calls within the loop are kept alive, preventing the compiler from fully optimizing away the loop body

    That's not just outermost function calls, it is all calls. So both `T(arg)` and `arg` (and `f(T(arg))`) should be kept alive.

    (But not from function calls that might appear after inlining. Just the ones that are syntactically there in the source code.)

    Cuong Manh Le

    Hmm, then I think even before this CL, only arg will be kept alive when T(arg) is a argument of function call.

    Should we let this CL in to fix the ICE, then followup CL will fix the semantics.

    Keith Randall

    Yes, sounds like a plan. The followup can be for 1.27, I think.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Cuong Manh Le
    Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
    Gerrit-Change-Number: 725420
    Gerrit-PatchSet: 2
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Comment-Date: Wed, 03 Dec 2025 00:56:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Keith Randall (Gerrit)

    unread,
    Dec 2, 2025, 7:56:51 PM (8 hours ago) Dec 2
    to Cuong Manh Le, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Junyang Shao, golang-co...@googlegroups.com
    Attention needed from Cuong Manh Le

    Keith Randall voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Cuong Manh Le
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
      Gerrit-Change-Number: 725420
      Gerrit-PatchSet: 2
      Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Comment-Date: Wed, 03 Dec 2025 00:56:46 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Keith Randall (Gerrit)

      unread,
      Dec 2, 2025, 7:57:03 PM (8 hours ago) Dec 2
      to Keith Randall, Cuong Manh Le, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Keith Randall, Go LUCI, Junyang Shao, golang-co...@googlegroups.com

      Keith Randall submitted the change

      Change information

      Commit message:
      cmd/compile: ensure bloop only kept alive addressable nodes

      Fixes #76636
      Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
      Auto-Submit: Cuong Manh Le <cuong.m...@gmail.com>
      Reviewed-by: Junyang Shao <shaoj...@google.com>
      Reviewed-by: Keith Randall <k...@golang.org>
      Reviewed-by: Keith Randall <k...@google.com>
      Files:
      • M src/cmd/compile/internal/bloop/bloop.go
      • M test/bloop.go
      Change size: S
      Delta: 2 files changed, 24 insertions(+), 5 deletions(-)
      Branch: refs/heads/master
      Submit Requirements:
      • requirement satisfiedCode-Review: +2 by Keith Randall, +2 by Junyang Shao, +1 by Keith Randall
      • 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: I881f88dbf62a901452c1d77e6ffca651451c7790
      Gerrit-Change-Number: 725420
      Gerrit-PatchSet: 3
      open
      diffy
      satisfied_requirement

      Cuong Manh Le (Gerrit)

      unread,
      Dec 2, 2025, 9:15:14 PM (6 hours ago) Dec 2
      to Keith Randall, goph...@pubsubhelper.golang.org, Keith Randall, Go LUCI, Junyang Shao, golang-co...@googlegroups.com

      Cuong Manh Le added 1 comment

      File src/cmd/compile/internal/bloop/bloop.go
      Line 56, Patchset 2: return n.(*ir.Name)
      Keith Randall . resolved

      getNameFromNode isn't used any more.
      Can we just leave the name as is, and put the additional condition in right here?

      ```
      name := n.(*ir.Name)
      if !ir.IsAddressable(name) {
      name = nil
      }
      return name
      ```
      Cuong Manh Le

      I also thought about this, but I’m afraid we wont catch all cases here, for example, all OCONV, OVONVNOP, OCONVIFACE below can return ONAME, too.

      That’s why I ended up with new entrypoint to catch ONAME, I think it would make things easier when bisecting needed. We can cleanup then when we are sure that nothing broken.

      Cuong Manh Le

      Hmm, further brainstorming, in case of `f(T(arg))`, what do we want to keep alive? It's `T(arg)` or `arg`?

      Keith Randall

      The spec for b.Loop says

       arguments to and results from function calls within the loop are kept alive, preventing the compiler from fully optimizing away the loop body

      That's not just outermost function calls, it is all calls. So both `T(arg)` and `arg` (and `f(T(arg))`) should be kept alive.

      (But not from function calls that might appear after inlining. Just the ones that are syntactically there in the source code.)

      Cuong Manh Le

      Hmm, then I think even before this CL, only arg will be kept alive when T(arg) is a argument of function call.

      Should we let this CL in to fix the ICE, then followup CL will fix the semantics.

      Keith Randall

      Yes, sounds like a plan. The followup can be for 1.27, I think.

      Cuong Manh Le

      Yeah, agree.

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I881f88dbf62a901452c1d77e6ffca651451c7790
      Gerrit-Change-Number: 725420
      Gerrit-PatchSet: 3
      Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: Keith Randall <k...@google.com>
      Gerrit-Comment-Date: Wed, 03 Dec 2025 02:15:06 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages