diff options
author | Alexandru Moșoi <mosoi@google.com> | 2016-04-13 10:58:38 +0200 |
---|---|---|
committer | Alexandru Moșoi <alexandru@mosoi.ro> | 2016-04-13 12:42:44 +0000 |
commit | e0611b16645dba6768cab405f1ec1b3fce83334a (patch) | |
tree | e30b48f6da6d38847560361b48401bdf63c09594 /src/cmd/compile/internal/ssa/cse.go | |
parent | 61b7a9c57bb6b9c259360239001b2d5be4876abd (diff) | |
download | go-e0611b16645dba6768cab405f1ec1b3fce83334a.tar.gz go-e0611b16645dba6768cab405f1ec1b3fce83334a.zip |
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>
Diffstat (limited to 'src/cmd/compile/internal/ssa/cse.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/cse.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/ssa/cse.go b/src/cmd/compile/internal/ssa/cse.go index 9853ff06d0..c12d51e50c 100644 --- a/src/cmd/compile/internal/ssa/cse.go +++ b/src/cmd/compile/internal/ssa/cse.go @@ -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 { |