mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: compute Divu's limits from argument's limits
Change-Id: Id522bde5bba627d9cdc8c3d8e907bdc168e5b13c Reviewed-on: https://go-review.googlesource.com/c/go/+/605157 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
parent
194fa2eb6c
commit
e23ebec90d
2 changed files with 34 additions and 0 deletions
|
|
@ -1780,6 +1780,17 @@ func (ft *factsTable) flowLimit(v *Value) bool {
|
|||
b := ft.limits[v.Args[1].ID]
|
||||
// Underflow in the arithmetic below is ok, it gives to MaxUint64 which does nothing to the limit.
|
||||
return ft.unsignedMax(v, minU(a.umax, b.umax-1))
|
||||
case OpDiv64u, OpDiv32u, OpDiv16u, OpDiv8u:
|
||||
a := ft.limits[v.Args[0].ID]
|
||||
b := ft.limits[v.Args[1].ID]
|
||||
lim := noLimit
|
||||
if b.umax > 0 {
|
||||
lim = lim.unsignedMin(a.umin / b.umax)
|
||||
}
|
||||
if b.umin > 0 {
|
||||
lim = lim.unsignedMax(a.umax / b.umin)
|
||||
}
|
||||
return ft.newLimit(v, lim)
|
||||
|
||||
case OpPhi:
|
||||
// Compute the union of all the input phis.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue