[go] cmd/compile: avoid panic in ternary rewrite on checked instructions

10 views
Skip to first unread message

Eyal Cohen (Gerrit)

unread,
Feb 13, 2026, 3:23:59 PM (12 days ago) Feb 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Eyal Cohen has uploaded the change for review

Commit message

cmd/compile: avoid panic in ternary rewrite on checked instructions

The replace function in rewritetern.go was panicing when encountering
instructions that had already been processed. This adds a check to
ensure we don't trigger a panic on these instructions.

Fixes #77582
Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe

Change diff

diff --git a/src/cmd/compile/internal/ssa/rewritetern.go b/src/cmd/compile/internal/ssa/rewritetern.go
index 5493e5f..5c9b889 100644
--- a/src/cmd/compile/internal/ssa/rewritetern.go
+++ b/src/cmd/compile/internal/ssa/rewritetern.go
@@ -174,6 +174,9 @@
replace := func(a0 *Value, vars0 [3]*Value) {
imm := computeTT(a0, vars0)
op := ternOpForLogical(a0.Op)
+ if a0.Op >= OpAMD64LoweredGetClosurePtr {
+ return // It is already an AMD64 machine instruction
+ }
if op == a0.Op {
panic(fmt.Errorf("should have mapped away from input op, a0 is %s", a0.LongString()))
}

Change information

Files:
  • M src/cmd/compile/internal/ssa/rewritetern.go
Change size: XS
Delta: 1 file changed, 3 insertions(+), 0 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: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 1
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Feb 13, 2026, 3:25:50 PM (12 days ago) Feb 13
to Eyal Cohen, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Message from Gopher Robot

Congratulations on opening your first change. Thank you for your contribution!

Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.

Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.

During May-July and Nov-Jan the Go project is in a code freeze, during which
little code gets reviewed or merged. If a reviewer responds with a comment like
R=go1.11 or adds a tag like "wait-release", it means that this CL will be
reviewed as part of the next development cycle. See https://go.dev/s/release
for more details.

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: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 1
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Comment-Date: Fri, 13 Feb 2026 20:25:46 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

David Chase (Gerrit)

unread,
Feb 13, 2026, 3:35:24 PM (12 days ago) Feb 13
to Eyal Cohen, goph...@pubsubhelper.golang.org, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Eyal Cohen

David Chase voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Eyal Cohen
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: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 1
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
Gerrit-Comment-Date: Fri, 13 Feb 2026 20:35:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Eyal Cohen (Gerrit)

unread,
Feb 13, 2026, 4:13:33 PM (12 days ago) Feb 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Eyal Cohen

Eyal Cohen uploaded new patchset

Eyal Cohen uploaded patch set #3 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:
  • Eyal Cohen
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: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 3
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Eyal Cohen (Gerrit)

unread,
Feb 13, 2026, 4:17:54 PM (12 days ago) Feb 13
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Eyal Cohen

Eyal Cohen uploaded new patchset

Eyal Cohen uploaded patch set #4 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Eyal Cohen
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: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 4
unsatisfied_requirement
satisfied_requirement
open
diffy

David Chase (Gerrit)

unread,
Feb 16, 2026, 11:34:45 AM (9 days ago) Feb 16
to Eyal Cohen, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Eyal Cohen

David Chase voted

Code-Review+2
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Eyal Cohen
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: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 4
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
Gerrit-Comment-Date: Mon, 16 Feb 2026 16:34:41 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Eyal Cohen (Gerrit)

unread,
Feb 16, 2026, 11:57:12 AM (9 days ago) Feb 16
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from David Chase and Eyal Cohen

Eyal Cohen uploaded new patchset

Eyal Cohen uploaded patch set #5 to this change.
Following approvals got outdated and were removed:
  • Code-Review: +2 by David Chase
  • TryBots-Pass: LUCI-TryBot-Result-1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Eyal Cohen
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: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 5
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: David Chase <drc...@google.com>
Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Eyal Cohen (Gerrit)

unread,
Feb 16, 2026, 5:14:58 PM (8 days ago) Feb 16
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from David Chase and Eyal Cohen

Eyal Cohen uploaded new patchset

Eyal Cohen uploaded patch set #6 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
  • Eyal Cohen
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: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 6
unsatisfied_requirement
satisfied_requirement
open
diffy

Eyal Cohen (Gerrit)

unread,
Feb 17, 2026, 12:47:59 PM (8 days ago) Feb 17
to goph...@pubsubhelper.golang.org, Go LUCI, David Chase, Gopher Robot, golang-co...@googlegroups.com
Attention needed from David Chase

Eyal Cohen added 1 comment

Patchset-level comments
File-level comment, Patchset 6 (Latest):
Eyal Cohen . resolved

PS6 is ready. Fixed the //go:build tags and changed the code to use _ = instead of fmt.Print

Open in Gerrit

Related details

Attention is currently required from:
  • David Chase
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: I0b38312109b9cedaa1cb1320015097d62588a2fe
Gerrit-Change-Number: 745460
Gerrit-PatchSet: 6
Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: David Chase <drc...@google.com>
Gerrit-Comment-Date: Tue, 17 Feb 2026 17:47:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
satisfied_requirement
open
diffy

David Chase (Gerrit)

unread,
Feb 18, 2026, 11:06:01 AM (7 days ago) Feb 18
to Eyal Cohen, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Eyal Cohen

David Chase voted and added 3 comments

Votes added by David Chase

Commit-Queue+1

3 comments

Patchset-level comments
David Chase . resolved

More requests, sorry not to catch this on the first time around, and thanks for fixing my bug (I wrote this code, oops). I suspect the trybots will fail again because of build flags and/or lack of an AVX512 check.

File src/cmd/compile/internal/ssa/issue77582_test.go
Line 5, Patchset 6 (Latest)://go:build amd64
David Chase . unresolved

I think you want
```
//go:build goexperiment.simd && amd64
```
and maybe it should be in sim/archsimd/internal/simd_test
where everything is run with the appropriate build flags.

Line 16, Patchset 6 (Latest): resultsMask := archsimd.Mask64x8{}
David Chase . unresolved
I'm pretty sure you need to gate this test (and it should fail some trybots)
```
if !archsimd.X86.AVX512() {
t.Skip("Test only applies to AVX512")
}
```
Open in Gerrit

Related details

Attention is currently required from:
  • Eyal Cohen
Submit Requirements:
    • requirement is not 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: I0b38312109b9cedaa1cb1320015097d62588a2fe
    Gerrit-Change-Number: 745460
    Gerrit-PatchSet: 6
    Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
    Gerrit-Comment-Date: Wed, 18 Feb 2026 16:05:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    open
    diffy

    Eyal Cohen (Gerrit)

    unread,
    Feb 18, 2026, 11:32:06 AM (7 days ago) Feb 18
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from David Chase and Eyal Cohen

    Eyal Cohen uploaded new patchset

    Eyal Cohen uploaded patch set #8 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:
    • David Chase
    • Eyal Cohen
    Submit Requirements:
    • requirement is not 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: I0b38312109b9cedaa1cb1320015097d62588a2fe
    Gerrit-Change-Number: 745460
    Gerrit-PatchSet: 8
    Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
    Gerrit-Reviewer: David Chase <drc...@google.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    unsatisfied_requirement
    open
    diffy

    Eyal Cohen (Gerrit)

    unread,
    Feb 18, 2026, 12:03:57 PM (7 days ago) Feb 18
    to goph...@pubsubhelper.golang.org, Go LUCI, David Chase, Gopher Robot, golang-co...@googlegroups.com
    Attention needed from David Chase

    Eyal Cohen added 3 comments

    Patchset-level comments
    File-level comment, Patchset 8 (Latest):
    Eyal Cohen . resolved

    "Uploaded PS8. Applied the goexperiment.simd tag and the AVX512() check as requested

    File src/cmd/compile/internal/ssa/issue77582_test.go
    Line 5, Patchset 6://go:build amd64
    David Chase . resolved

    I think you want
    ```
    //go:build goexperiment.simd && amd64
    ```
    and maybe it should be in sim/archsimd/internal/simd_test
    where everything is run with the appropriate build flags.

    Eyal Cohen

    Done

    Line 16, Patchset 6: resultsMask := archsimd.Mask64x8{}
    David Chase . resolved
    I'm pretty sure you need to gate this test (and it should fail some trybots)
    ```
    if !archsimd.X86.AVX512() {
    t.Skip("Test only applies to AVX512")
    }
    ```
    Eyal Cohen

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • David Chase
    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: I0b38312109b9cedaa1cb1320015097d62588a2fe
      Gerrit-Change-Number: 745460
      Gerrit-PatchSet: 8
      Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: David Chase <drc...@google.com>
      Gerrit-Comment-Date: Wed, 18 Feb 2026 17:03:51 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: David Chase <drc...@google.com>
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      David Chase (Gerrit)

      unread,
      Feb 18, 2026, 4:30:11 PM (7 days ago) Feb 18
      to Eyal Cohen, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Eyal Cohen

      David Chase voted Commit-Queue+1

      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Eyal Cohen
      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: I0b38312109b9cedaa1cb1320015097d62588a2fe
      Gerrit-Change-Number: 745460
      Gerrit-PatchSet: 8
      Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
      Gerrit-Comment-Date: Wed, 18 Feb 2026 21:30:08 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      David Chase (Gerrit)

      unread,
      Feb 19, 2026, 1:11:12 PM (6 days ago) Feb 19
      to Eyal Cohen, goph...@pubsubhelper.golang.org, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Eyal Cohen

      David Chase voted Code-Review+2

      Code-Review+2
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Eyal Cohen
      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: I0b38312109b9cedaa1cb1320015097d62588a2fe
      Gerrit-Change-Number: 745460
      Gerrit-PatchSet: 8
      Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
      Gerrit-Reviewer: David Chase <drc...@google.com>
      Gerrit-CC: Gopher Robot <go...@golang.org>
      Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
      Gerrit-Comment-Date: Thu, 19 Feb 2026 18:11:09 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mark Freeman (Gerrit)

      unread,
      Feb 19, 2026, 3:16:43 PM (6 days ago) Feb 19
      to Eyal Cohen, goph...@pubsubhelper.golang.org, David Chase, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
      Attention needed from Eyal Cohen

      Mark Freeman voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Eyal Cohen
      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: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Gerrit-Change-Number: 745460
        Gerrit-PatchSet: 8
        Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
        Gerrit-Reviewer: David Chase <drc...@google.com>
        Gerrit-Reviewer: Mark Freeman <markf...@google.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
        Gerrit-Comment-Date: Thu, 19 Feb 2026 20:16:38 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        David Chase (Gerrit)

        unread,
        Feb 24, 2026, 1:29:09 PM (16 hours ago) Feb 24
        to Eyal Cohen, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Mark Freeman, Go LUCI, Gopher Robot, golang-co...@googlegroups.com

        David Chase submitted the change

        Change information

        Commit message:
        cmd/compile: avoid panic in ternary rewrite on checked instructions

        The replace function in rewritetern.go was panicing when encountering
        instructions that had already been processed. This adds a check to
        ensure we don't trigger a panic on these instructions.

        Fixes #77582
        Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Reviewed-by: David Chase <drc...@google.com>
        Reviewed-by: Mark Freeman <markf...@google.com>
        Files:
        • A src/cmd/compile/internal/ssa/issue77582_test.go
        • M src/cmd/compile/internal/ssa/rewritetern.go
        Change size: S
        Delta: 2 files changed, 32 insertions(+), 0 deletions(-)
        Branch: refs/heads/master
        Submit Requirements:
        • requirement satisfiedCode-Review: +1 by Mark Freeman, +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: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Gerrit-Change-Number: 745460
        Gerrit-PatchSet: 9
        open
        diffy
        satisfied_requirement

        Eyal Cohen (Gerrit)

        unread,
        Feb 24, 2026, 1:46:06 PM (15 hours ago) Feb 24
        to David Chase, goph...@pubsubhelper.golang.org, Mark Freeman, Go LUCI, Gopher Robot, golang-co...@googlegroups.com

        Eyal Cohen added 1 comment

        Patchset-level comments
        File-level comment, Patchset 9 (Latest):
        Eyal Cohen . resolved

        Hi David, thanks for the merge! While working on my project. I noticed we don't seem to have functions for ANDNOT/NOT with masks in simd/archsimd.
        I was wondering if there's a specific reason we don't normalize these into a more direct instruction form during the SSA phase, or if it's just a case where the backend is expected to catch it during instruction selection?
        I'd love to explore adding a rule for this if you think it's worthwhile.

        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: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Gerrit-Change-Number: 745460
        Gerrit-PatchSet: 9
        Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
        Gerrit-Reviewer: David Chase <drc...@google.com>
        Gerrit-Reviewer: Mark Freeman <markf...@google.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 18:45:58 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        open
        diffy

        David Chase (Gerrit)

        unread,
        Feb 24, 2026, 2:27:10 PM (15 hours ago) Feb 24
        to goph...@pubsubhelper.golang.org, Eyal Cohen, golang-co...@googlegroups.com

        David Chase has uploaded the change for review

        Commit message

        [release-branch.go1.26] cmd/compile: avoid panic in ternary rewrite on checked instructions


        The replace function in rewritetern.go was panicing when encountering
        instructions that had already been processed. This adds a check to
        ensure we don't trigger a panic on these instructions.

        Fixes #77773


        Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Reviewed-on: https://go-review.googlesource.com/c/go/+/745460
        LUCI-TryBot-Result: Go LUCI <golang...@luci-project-accounts.iam.gserviceaccount.com>
        Reviewed-by: David Chase <drc...@google.com>
        Reviewed-by: Mark Freeman <markf...@google.com>
        (cherry picked from commit 8438ace20738cbb1faab5708837e57a50aa774d3)

        Change diff

        diff --git a/src/cmd/compile/internal/ssa/issue77582_test.go b/src/cmd/compile/internal/ssa/issue77582_test.go
        new file mode 100644
        index 0000000..d7bcda6
        --- /dev/null
        +++ b/src/cmd/compile/internal/ssa/issue77582_test.go
        @@ -0,0 +1,29 @@
        +// Copyright 2026 The Go Authors. All rights reserved.
        +// Use of this source code is governed by a BSD-style
        +// license that can be found in the LICENSE file.
        +
        +//go:build goexperiment.simd && amd64
        +
        +package ssa
        +
        +import (
        + "testing"
        +
        + "cmd/compile/internal/archsimd"
        +)
        +
        +func TestVPTERNLOGDPanic(t *testing.T) {
        + if !archsimd.X86.AVX512() {
        + t.Skip("Test only applies to AVX512")
        + }
        +
        + resultsMask := archsimd.Mask64x8{}
        + a := archsimd.Mask64x8FromBits(0xFF)
        + b := archsimd.Float64x8{}.Less(archsimd.Float64x8{})
        +
        + for i := 0; i < 1; i++ {
        + resultsMask = a.Or(b).Or(resultsMask)
        + // This nested logic triggered the panic
        + _ = resultsMask.And(resultsMask.And(archsimd.Mask64x8{}))
        + }
        +}

        diff --git a/src/cmd/compile/internal/ssa/rewritetern.go b/src/cmd/compile/internal/ssa/rewritetern.go
        index 5493e5f..5c9b889 100644
        --- a/src/cmd/compile/internal/ssa/rewritetern.go
        +++ b/src/cmd/compile/internal/ssa/rewritetern.go
        @@ -174,6 +174,9 @@
        replace := func(a0 *Value, vars0 [3]*Value) {
        imm := computeTT(a0, vars0)
        op := ternOpForLogical(a0.Op)
        + if a0.Op >= OpAMD64LoweredGetClosurePtr {
        + return // It is already an AMD64 machine instruction
        + }
        if op == a0.Op {
        panic(fmt.Errorf("should have mapped away from input op, a0 is %s", a0.LongString()))
        }

        Change information

        Files:
        • A src/cmd/compile/internal/ssa/issue77582_test.go
        • M src/cmd/compile/internal/ssa/rewritetern.go
        Change size: S
        Delta: 2 files changed, 32 insertions(+), 0 deletions(-)

        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: release-branch.go1.26
        Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Gerrit-Change-Number: 748540
        Gerrit-PatchSet: 1
        Gerrit-Owner: David Chase <drc...@google.com>
        Gerrit-CC: Eyal Cohen <yulu...@gmail.com>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        David Chase (Gerrit)

        unread,
        Feb 24, 2026, 2:27:21 PM (15 hours ago) Feb 24
        to Eyal Cohen, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        David Chase voted Commit-Queue+1

        Commit-Queue+1
        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: comment
        Gerrit-Project: go
        Gerrit-Branch: release-branch.go1.26
        Gerrit-Change-Id: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Gerrit-Change-Number: 748540
        Gerrit-PatchSet: 1
        Gerrit-Owner: David Chase <drc...@google.com>
        Gerrit-Reviewer: David Chase <drc...@google.com>
        Gerrit-CC: Eyal Cohen <yulu...@gmail.com>
        Gerrit-Comment-Date: Tue, 24 Feb 2026 19:27:16 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Cherry Mui (Gerrit)

        unread,
        Feb 24, 2026, 8:20:02 PM (9 hours ago) Feb 24
        to David Chase, Eyal Cohen, goph...@pubsubhelper.golang.org, Mark Freeman, Go LUCI, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Eyal Cohen

        Cherry Mui added 2 comments

        File src/cmd/compile/internal/ssa/issue77582_test.go
        Cherry Mui . unresolved

        For fixing compiler panic, we usually put tests in GOROOT/test. This should probably be test/simd/issue77582.go

        Line 12, Patchset 9 (Latest): "cmd/compile/internal/archsimd"
        Cherry Mui . unresolved

        This package doesn't exist. It should be simd/archsimd.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Eyal Cohen
        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: I0b38312109b9cedaa1cb1320015097d62588a2fe
        Gerrit-Change-Number: 745460
        Gerrit-PatchSet: 9
        Gerrit-Owner: Eyal Cohen <yulu...@gmail.com>
        Gerrit-Reviewer: David Chase <drc...@google.com>
        Gerrit-Reviewer: Mark Freeman <markf...@google.com>
        Gerrit-CC: Cherry Mui <cher...@google.com>
        Gerrit-CC: Gopher Robot <go...@golang.org>
        Gerrit-Attention: Eyal Cohen <yulu...@gmail.com>
        Gerrit-Comment-Date: Wed, 25 Feb 2026 01:19:58 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages