]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: enhance prove to deal with double-offset IsInBounds checks
authorDavid Chase <drchase@google.com>
Wed, 3 Sep 2025 17:09:32 +0000 (13:09 -0400)
committerCherry Mui <cherryyz@google.com>
Fri, 3 Oct 2025 19:30:29 +0000 (12:30 -0700)
commit1caa95acfa9d516eb3bc26292b5601bea25a4e79
treeadcd153dba6d6459db4b674b5ef86a00e5ae2136
parentec70d1902355f10e0ab4788334b80db11ab69785
cmd/compile: enhance prove to deal with double-offset IsInBounds checks

For chunked iterations (useful for, but not exclusive to,
SIMD calculations) it is common to see the combination of
```
for ; i <= len(m)-4; i += 4 {
```
and
```
r0, r1, r2, r3 := m[i], m[i+1], m[i+2], m[i+3]
``

Prove did not handle the case of len-offset1 vs index+offset2
checking, but this change fixes this.  There may be other
similar cases yet to handle -- this worked for the chunked
loops for simd, as well as a handful in std.

Cherry-picked from the dev.simd branch. This CL is not
necessarily SIMD specific. Apply early to reduce risk.

Change-Id: I3785df83028d517e5e5763206653b34b2befd3d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/700696
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/708859
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/prove.go
test/prove.go