]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/compile: teach prove about bitwise OR operation
authorWayne Zuo <wdvxdr@golangcn.org>
Sun, 5 Jun 2022 05:22:29 +0000 (13:22 +0800)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 31 Aug 2022 09:35:45 +0000 (09:35 +0000)
Fixes #45928.

Change-Id: Ifbb0effbca4ab7c0eb56069fee40edb564553c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/410336
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/compile/internal/ssa/prove.go
test/prove.go

index cebadcb42c463f48c7a12d610afe48126d793b77..20c967d0987f4187eb3a6490d892c7908977f74a 100644 (file)
@@ -842,6 +842,9 @@ func prove(f *Func) {
                        case OpAnd64, OpAnd32, OpAnd16, OpAnd8:
                                ft.update(b, v, v.Args[1], unsigned, lt|eq)
                                ft.update(b, v, v.Args[0], unsigned, lt|eq)
+                       case OpOr64, OpOr32, OpOr16, OpOr8:
+                               ft.update(b, v, v.Args[1], unsigned, gt|eq)
+                               ft.update(b, v, v.Args[0], unsigned, gt|eq)
                        }
                }
        }
index 5ccaff54ce2a292d5d8ddabad17250375eec6bde..1be257f20634845d47951dd6c52761c5a3f52d19 100644 (file)
@@ -1053,6 +1053,11 @@ func issue51622(b []byte) int {
        return 0
 }
 
+func issue45928(x int) {
+       combinedFrac := (x) / (x | (1 << 31)) // ERROR "Proved Neq64$"
+       useInt(combinedFrac)
+}
+
 //go:noinline
 func useInt(a int) {
 }