]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: use transitive relations for slice len/cap in poset
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 27 Nov 2020 19:46:00 +0000 (02:46 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 23 Feb 2021 05:01:04 +0000 (05:01 +0000)
commit5e804ba17da12f53c0d66c1ce1e0e7845feb7f69
treed0a2c8ba28bb60eb510da8ce86f44a4c02df18c2
parent6a40dd05d833b2bd78eb68ac67d7e860edff6878
cmd/compile: use transitive relations for slice len/cap in poset

Currently, we keep track of slice len by mapping from slice ID to
len/cap SSA value. However, slice len/cap can have multiple SSA values,
so when updating fact table for slice len/cap, we only update in one
place.

Instead, we can take advantage of the transitive relations provided by
poset. So all duplicated slice lens are set as equal to one another.
When updating fact table for one, that fact will be reflected to all
others. The same mechanism is applied for slice cap.

Removes 15 bounds checks from std/cmd.

Fixes #42603

Change-Id: I32c07968824cc33765b1e441b3ae2c4b5f5997c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/273670
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/prove.go
test/prove.go