mirror of
https://github.com/golang/go
synced 2024-11-19 08:44:39 -07:00
cmd/compile/internal/gc: tidy plive.go
Make boolean looking things boolean. Change-Id: I8d1c0a32b471412b25a72908c7da6458d7bbe65b Reviewed-on: https://go-review.googlesource.com/20723 Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
3648d2d4cd
commit
70090654de
@ -63,16 +63,16 @@ func bvandnot(dst Bvec, src1 Bvec, src2 Bvec) {
|
||||
}
|
||||
}
|
||||
|
||||
func bvcmp(bv1 Bvec, bv2 Bvec) int {
|
||||
func bveq(bv1 Bvec, bv2 Bvec) bool {
|
||||
if bv1.n != bv2.n {
|
||||
Fatalf("bvequal: lengths %d and %d are not equal", bv1.n, bv2.n)
|
||||
}
|
||||
for i, x := range bv1.b {
|
||||
if x != bv2.b[i] {
|
||||
return 1
|
||||
return false
|
||||
}
|
||||
}
|
||||
return 0
|
||||
return true
|
||||
}
|
||||
|
||||
func bvcopy(dst Bvec, src Bvec) {
|
||||
|
@ -1092,9 +1092,8 @@ func livenesssolve(lv *Liveness) {
|
||||
bvcopy(bb.avarinitany, bb.avarinit)
|
||||
}
|
||||
|
||||
change := int32(1)
|
||||
for change != 0 {
|
||||
change = 0
|
||||
for change := true; change; {
|
||||
change = false
|
||||
for _, bb := range lv.cfg {
|
||||
bvresetall(any)
|
||||
bvresetall(all)
|
||||
@ -1112,13 +1111,13 @@ func livenesssolve(lv *Liveness) {
|
||||
bvandnot(all, all, bb.varkill)
|
||||
bvor(any, any, bb.avarinit)
|
||||
bvor(all, all, bb.avarinit)
|
||||
if bvcmp(any, bb.avarinitany) != 0 {
|
||||
change = 1
|
||||
if !bveq(any, bb.avarinitany) {
|
||||
change = true
|
||||
bvcopy(bb.avarinitany, any)
|
||||
}
|
||||
|
||||
if bvcmp(all, bb.avarinitall) != 0 {
|
||||
change = 1
|
||||
if !bveq(all, bb.avarinitall) {
|
||||
change = true
|
||||
bvcopy(bb.avarinitall, all)
|
||||
}
|
||||
}
|
||||
@ -1127,10 +1126,9 @@ func livenesssolve(lv *Liveness) {
|
||||
// Iterate through the blocks in reverse round-robin fashion. A work
|
||||
// queue might be slightly faster. As is, the number of iterations is
|
||||
// so low that it hardly seems to be worth the complexity.
|
||||
change = 1
|
||||
|
||||
for change != 0 {
|
||||
change = 0
|
||||
for change := true; change; {
|
||||
change = false
|
||||
|
||||
// Walk blocks in the general direction of propagation. This
|
||||
// improves convergence.
|
||||
@ -1146,8 +1144,8 @@ func livenesssolve(lv *Liveness) {
|
||||
bvor(newliveout, newliveout, succ.livein)
|
||||
}
|
||||
|
||||
if bvcmp(bb.liveout, newliveout) != 0 {
|
||||
change = 1
|
||||
if !bveq(bb.liveout, newliveout) {
|
||||
change = true
|
||||
bvcopy(bb.liveout, newliveout)
|
||||
}
|
||||
|
||||
@ -1506,7 +1504,7 @@ func livenesscompact(lv *Liveness) {
|
||||
}
|
||||
jlocal := lv.livepointers[j]
|
||||
jarg := lv.argslivepointers[j]
|
||||
if bvcmp(local, jlocal) == 0 && bvcmp(arg, jarg) == 0 {
|
||||
if bveq(local, jlocal) && bveq(arg, jarg) {
|
||||
remap[i] = j
|
||||
goto Next
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user