]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: teach prove about subtract idioms
authorKeith Randall <khr@golang.org>
Fri, 14 Nov 2025 23:26:36 +0000 (15:26 -0800)
committerKeith Randall <khr@golang.org>
Mon, 17 Nov 2025 17:48:53 +0000 (09:48 -0800)
commitc12c33709923907348837e8131122ec4c45d2c83
tree802fa4e2ed731eabe6ded28f92cb36605f7c87f0
parentbc159638135e751a291fe6753fc8c8c3d61be863
cmd/compile: teach prove about subtract idioms

For v = x-y:
    if y >= 0 then v <= x
    if y <= x then v >= 0

(With appropriate guards against overflow/underflow.)

Fixes #76304

Change-Id: I8f8f1254156c347fa97802bd057a8379676720ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/720740
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/ssa/prove.go
test/prove.go