mirror of
https://github.com/golang/go.git
synced 2026-04-01 17:07:17 +09:00
cmd/compile: remove 68857 And flowLimit workaround in prove
Change-Id: Id8baeb89e6e11a01d53cd63c665f0b2966f50392 Reviewed-on: https://go-review.googlesource.com/c/go/+/750341 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
@@ -1884,11 +1884,6 @@ func (ft *factsTable) flowLimit(v *Value) {
|
||||
// TODO: if y.umax and y.umin share a leading bit pattern, y also has that leading bit pattern.
|
||||
// we could compare the patterns of always set bits in a and b and learn more about minimum and maximum.
|
||||
// But I doubt this help any real world code.
|
||||
case OpAnd64, OpAnd32, OpAnd16, OpAnd8:
|
||||
// AND can only make the value smaller.
|
||||
a := ft.limits[v.Args[0].ID]
|
||||
b := ft.limits[v.Args[1].ID]
|
||||
ft.unsignedMax(v, min(a.umax, b.umax))
|
||||
case OpOr64, OpOr32, OpOr16, OpOr8:
|
||||
// OR can only make the value bigger and can't flip bits proved to be zero in both inputs.
|
||||
a := ft.limits[v.Args[0].ID]
|
||||
|
||||
@@ -2823,6 +2823,25 @@ func noopAnd64DoNothingMayClearVarying(x uint64) uint64 {
|
||||
return x
|
||||
}
|
||||
|
||||
func limitFlowThroughAnd(x, y uint64, ensureAllBranchesCouldHappen func() bool) int {
|
||||
x = min(x, 1337)
|
||||
x &= y
|
||||
if ensureAllBranchesCouldHappen() && x <= 1337 { // ERROR "Proved Leq64U$"
|
||||
return 1
|
||||
}
|
||||
if ensureAllBranchesCouldHappen() && x < 1338 { // ERROR "Proved Less64U$"
|
||||
return 2
|
||||
}
|
||||
|
||||
if ensureAllBranchesCouldHappen() && x <= 1336 {
|
||||
return 3
|
||||
}
|
||||
if ensureAllBranchesCouldHappen() && x < 1337 {
|
||||
return 4
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func prove(x int) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user