mirror of
https://github.com/golang/go.git
synced 2026-06-27 03:11:23 +00:00
cmd/compile/internal/ssa: limit call stack use in known bits
Due to SSA properties, iterating over blocks postorder will make fold encounter uses before their definition, ensuring that it recurses down into the use-def chain. Iterating in reverse postorder minimizes this recursion. Change-Id: I7847c7384477d8c42d5d5586532cd9e26a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/770340 Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
This commit is contained in:
parent
914b632202
commit
be9da6ce60
1 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
package ssa
|
||||
|
||||
import "slices"
|
||||
|
||||
func (kb *knownBitsState) fold(v *Value) (value, known int64) {
|
||||
if kb.seenValues.Test(uint32(v.ID)) {
|
||||
return kb.entries[v.ID].value, kb.entries[v.ID].known
|
||||
|
|
@ -167,7 +169,7 @@ func knownBits(f *Func) {
|
|||
kb.reachableBlocks.Set(uint32(b.ID))
|
||||
}
|
||||
|
||||
for _, b := range blocks {
|
||||
for _, b := range slices.Backward(blocks) {
|
||||
for _, v := range b.Values {
|
||||
if v.Uses == 0 || !(v.Type.IsInteger() || v.Type.IsBoolean()) {
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue