mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: use shared dom tree for cse, too
Missed this in the previous CL where the shared dom tree was introduced. Change-Id: If0bd85d4b4567d7e87814ed511603b1303ab3903 Reviewed-on: https://go-review.googlesource.com/21970 Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
61b7a9c57b
commit
e0611b1664
3 changed files with 7 additions and 7 deletions
|
|
@ -131,9 +131,7 @@ func cse(f *Func) {
|
|||
}
|
||||
}
|
||||
|
||||
// Compute dominator tree
|
||||
idom := dominators(f)
|
||||
sdom := newSparseTree(f, idom)
|
||||
// Dominator tree (f.sdom) is computed by the generic domtree pass.
|
||||
|
||||
// Compute substitutions we would like to do. We substitute v for w
|
||||
// if v and w are in the same equivalence class and v dominates w.
|
||||
|
|
@ -143,7 +141,7 @@ func cse(f *Func) {
|
|||
// Find a maximal dominant element in e
|
||||
v := e[0]
|
||||
for _, w := range e[1:] {
|
||||
if sdom.isAncestorEq(w.Block, v.Block) {
|
||||
if f.sdom.isAncestorEq(w.Block, v.Block) {
|
||||
v = w
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +151,7 @@ func cse(f *Func) {
|
|||
w := e[i]
|
||||
if w == v {
|
||||
e, e[i] = e[:len(e)-1], e[len(e)-1]
|
||||
} else if sdom.isAncestorEq(v.Block, w.Block) {
|
||||
} else if f.sdom.isAncestorEq(v.Block, w.Block) {
|
||||
rewrite[w.ID] = v
|
||||
e, e[i] = e[:len(e)-1], e[len(e)-1]
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue