diff options
| author | David Chase <drchase@google.com> | 2026-02-25 15:56:36 -0500 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2026-02-26 10:38:59 -0800 |
| commit | 89d92fc21166c27db7d4203d93019e33f8cb9695 (patch) | |
| tree | d34311fb033414bf72ee5ad4b08849990a1ba809 /src | |
| parent | b4ef60b9cb74c24108ad02cc11531c0f144bb77d (diff) | |
| download | go-89d92fc21166c27db7d4203d93019e33f8cb9695.tar.xz | |
cmd/compile: ternary rewrite of rewrite should skip, not panic
The panic was unnecessary, if there's nothing to rewrite,
just do nothing. Added a debug message for this to help
with testing; it seems (from accidentally perturbing the
test away from failure) to be somewhat rare, so likely
okay to mingle with the other debugging output.
Fixes #77582.
Change-Id: I676396f4bb530cb6b55dfe543ad489f84710900d
Reviewed-on: https://go-review.googlesource.com/c/go/+/749241
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/compile/internal/ssa/rewritetern.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/ssa/rewritetern.go b/src/cmd/compile/internal/ssa/rewritetern.go index 5493e5f109..766b3f898c 100644 --- a/src/cmd/compile/internal/ssa/rewritetern.go +++ b/src/cmd/compile/internal/ssa/rewritetern.go @@ -5,7 +5,6 @@ package ssa import ( - "fmt" "internal/goarch" "slices" ) @@ -175,7 +174,10 @@ func rewriteTern(f *Func) { imm := computeTT(a0, vars0) op := ternOpForLogical(a0.Op) if op == a0.Op { - panic(fmt.Errorf("should have mapped away from input op, a0 is %s", a0.LongString())) + if f.pass.debug > 0 { + f.Warnl(a0.Pos, "Skipping rewrite for %s, op=%v", a0.LongString(), op) + } + return } if f.pass.debug > 0 { f.Warnl(a0.Pos, "Rewriting %s into %v of 0b%b %v %v %v", a0.LongString(), op, imm, |
