From: Marcel Meyer Date: Fri, 11 Apr 2025 20:14:04 +0000 (+0000) Subject: cmd/compile/internal/ssa: small cleanups X-Git-Tag: go1.25rc1~489 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=56fad21c22ece03a3f1f059fa67d7593278eb5f4;p=gostls13.git cmd/compile/internal/ssa: small cleanups Change-Id: I0420fb3956577c56fa24a31929331d526d480556 GitHub-Last-Rev: d74b0d4d75d4e432aaf84d02964da4a2e12d0e1b GitHub-Pull-Request: golang/go#73339 Reviewed-on: https://go-review.googlesource.com/c/go/+/664975 Reviewed-by: Keith Randall Reviewed-by: Keith Randall Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Auto-Submit: Keith Randall --- diff --git a/src/cmd/compile/internal/ssa/prove.go b/src/cmd/compile/internal/ssa/prove.go index ad03ce87ec..94f23a84aa 100644 --- a/src/cmd/compile/internal/ssa/prove.go +++ b/src/cmd/compile/internal/ssa/prove.go @@ -664,7 +664,7 @@ func (ft *factsTable) newLimit(v *Value, newLim limit) bool { d |= unsigned } if !isTrue { - r ^= (lt | gt | eq) + r ^= lt | gt | eq } // TODO: v.Block is wrong? addRestrictions(v.Block, ft, d, v.Args[0], v.Args[1], r) @@ -697,7 +697,7 @@ func (ft *factsTable) newLimit(v *Value, newLim limit) bool { // But in the signed domain, we can't express the || // condition, so check if a0 is non-negative instead, // to be able to learn something. - r ^= (lt | gt | eq) // >= (index) or > (slice) + r ^= lt | gt | eq // >= (index) or > (slice) if ft.isNonNegative(v.Args[0]) { ft.update(v.Block, v.Args[0], v.Args[1], signed, r) } @@ -1299,8 +1299,8 @@ func prove(f *Func) { } // try to rewrite to a downward counting loop checking against start if the - // loop body does not depends on ind or nxt and end is known before the loop. - // This reduce pressure on the register allocator because this do not need + // loop body does not depend on ind or nxt and end is known before the loop. + // This reduces pressure on the register allocator because this does not need // to use end on each iteration anymore. We compare against the start constant instead. // That means this code: // @@ -1332,7 +1332,7 @@ func prove(f *Func) { // // exit_loop: // - // this is better because it only require to keep ind then nxt alive while looping, + // this is better because it only requires to keep ind then nxt alive while looping, // while the original form keeps ind then nxt and end alive start, end := v.min, v.max if v.flags&indVarCountDown != 0 { @@ -1355,7 +1355,7 @@ func prove(f *Func) { if end.Block == ind.Block { // we can't rewrite loops where the condition depends on the loop body - // this simple check is forced to work because if this is true a Phi in ind.Block must exists + // this simple check is forced to work because if this is true a Phi in ind.Block must exist continue }