]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: move limit fact table in prove pass to dense encoding
authorkhr@golang.org <khr@golang.org>
Sat, 18 May 2024 15:01:27 +0000 (08:01 -0700)
committerKeith Randall <khr@golang.org>
Wed, 7 Aug 2024 16:07:21 +0000 (16:07 +0000)
commit553443d41fbe643a29d452a5d4d4ce3b7442b0e9
tree6c94949e583d122088288a1f61f21329ae9df35a
parente705a2d16e4ece77e08e80c168382cdb02890f5b
cmd/compile: move limit fact table in prove pass to dense encoding

Here begins a pretty major rewrite of the prove pass. The fundamental
observation is that although keeping facts about relations between
two SSA values could use O(n^2) space, keeping facts about relations
between an SSA value and constants needs only O(n) space. We can just
keep track of min/max for every SSA value at little cost.

Redo the limit table to just keep track of limits for all SSA values.
Use just a slice instead of a map. It may use more space (but still
just O(n) space), but accesses are a lot faster. And with the cache
in the compiler, that space will be reused quickly.

This is part of my planning to add lots more constant limits in the
prove pass.

Change-Id: Ie36819fad5631a8b79c3630fe0e819521796551a
Reviewed-on: https://go-review.googlesource.com/c/go/+/599255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/cmd/compile/internal/ssa/_gen/allocators.go
src/cmd/compile/internal/ssa/allocators.go
src/cmd/compile/internal/ssa/cache.go
src/cmd/compile/internal/ssa/prove.go