mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: compute OR's maximum limits from argument's limits
Change-Id: I6902c405cab7bd573f6a721a6ca7c783713ea39a Reviewed-on: https://go-review.googlesource.com/c/go/+/604456 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
49621cc311
commit
57df33814a
2 changed files with 22 additions and 2 deletions
|
|
@ -1698,10 +1698,12 @@ func (ft *factsTable) flowLimit(v *Value) bool {
|
|||
b := ft.limits[v.Args[1].ID]
|
||||
return ft.unsignedMax(v, minU(a.umax, b.umax))
|
||||
case OpOr64, OpOr32, OpOr16, OpOr8:
|
||||
// OR can only make the value bigger.
|
||||
// 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]
|
||||
b := ft.limits[v.Args[1].ID]
|
||||
return ft.unsignedMin(v, maxU(a.umin, b.umin))
|
||||
return ft.unsignedMinMax(v,
|
||||
maxU(a.umin, b.umin),
|
||||
1<<bits.Len64(a.umax|b.umax)-1)
|
||||
case OpXor64, OpXor32, OpXor16, OpXor8:
|
||||
// XOR can't flip bits that are proved to be zero in both inputs.
|
||||
a := ft.limits[v.Args[0].ID]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue