[dev.ssa] cmd/compile: small optimization to prove using sdom tweak

Exposed data already in sdom to avoid recreating it in prove.

Change-Id: I834c9c03ed8faeaee013e5a1b3f955908f0e0915
Reviewed-on: https://go-review.googlesource.com/19999
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexandru Moșoi <alexandru@mosoi.ro>
This commit is contained in:
David Chase 2016-02-28 15:58:17 -05:00
parent bdea1d58cf
commit 34f048c9d9
2 changed files with 19 additions and 11 deletions

View file

@ -127,14 +127,6 @@ var (
func prove(f *Func) {
idom := dominators(f)
sdom := newSparseTree(f, idom)
domTree := make([][]*Block, f.NumBlocks())
// Create a block ID -> [dominees] mapping
for _, b := range f.Blocks {
if dom := idom[b.ID]; dom != nil {
domTree[dom.ID] = append(domTree[dom.ID], b)
}
}
// current node state
type walkState int
@ -179,7 +171,7 @@ func prove(f *Func) {
saved: saved,
})
for _, s := range domTree[node.block.ID] {
for s := sdom.Child(node.block); s != nil; s = sdom.Sibling(s) {
work = append(work, bp{
block: s,
state: descend,