diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2020-03-09 06:37:49 -0700 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2020-03-09 20:19:25 +0000 |
commit | 5fac45a320561b45b52cdcae933882a70699a21d (patch) | |
tree | b82846841f8e3ef2e930ec43fe2acfae8ce0b690 /src/cmd/compile/internal/ssa/prove.go | |
parent | 3afa86d632859ec61207ce307ba69394e0c7462d (diff) | |
download | go-5fac45a320561b45b52cdcae933882a70699a21d.tar.gz go-5fac45a320561b45b52cdcae933882a70699a21d.zip |
cmd/compile: use only bit patterns in isNonNegative
CL 212777 added a check to isNonNegative
to return true for unsigned values.
However, the SSA backend isn't type safe
enough for that to be sound.
The other checks in isNonNegative
look only at the pattern of bits.
Remove the type-based check.
Updates #37753
Change-Id: I059d0e86353453133f2a160dce53af299f42e533
Reviewed-on: https://go-review.googlesource.com/c/go/+/222620
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/prove.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/prove.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/ssa/prove.go b/src/cmd/compile/internal/ssa/prove.go index 4788f2d803..12c2580c95 100644 --- a/src/cmd/compile/internal/ssa/prove.go +++ b/src/cmd/compile/internal/ssa/prove.go @@ -1305,9 +1305,9 @@ func isNonNegative(v *Value) bool { if !v.Type.IsInteger() { panic("isNonNegative bad type") } - if !v.Type.IsSigned() { - return true - } + // TODO: return true if !v.Type.IsSigned() + // SSA isn't type-safe enough to do that now (issue 37753). + // The checks below depend only on the pattern of bits. switch v.Op { case OpConst64: |