diff options
author | Todd Neal <todd@tneal.org> | 2016-02-10 19:39:32 -0600 |
---|---|---|
committer | Todd Neal <todd@tneal.org> | 2016-02-22 13:06:18 +0000 |
commit | 94f02451148755b31cc4dd455c9e215d5f898898 (patch) | |
tree | 2bc228b54940eca91cb2f664334f8a1f1d64c802 /src/cmd/compile/internal/ssa/cse.go | |
parent | 4827c6d0778d93afeaee658a330d97b8f1b510a6 (diff) | |
download | go-94f02451148755b31cc4dd455c9e215d5f898898.tar.gz go-94f02451148755b31cc4dd455c9e215d5f898898.zip |
[dev.ssa] cmd/compile: add a zero arg cse pass
Add an initial cse pass that only operates on zero argument
values. This removes the need for a special case in cse for removing
OpSB and speeds up arithConst_ssa.go compilation by 9% while slowing
"test -c net/http" by 1.5%.
Change-Id: Id1500482485426f66c6c2eba75eeaf4f19c8a889
Reviewed-on: https://go-review.googlesource.com/19454
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/cse.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/cse.go | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/src/cmd/compile/internal/ssa/cse.go b/src/cmd/compile/internal/ssa/cse.go index 36ab6a3680..545e173928 100644 --- a/src/cmd/compile/internal/ssa/cse.go +++ b/src/cmd/compile/internal/ssa/cse.go @@ -13,34 +13,6 @@ import ( // Values are just relinked, nothing is deleted. A subsequent deadcode // pass is required to actually remove duplicate expressions. func cse(f *Func) { - if !f.Config.optimize { - // Don't do CSE in this case. But we need to do - // just a little bit, to combine multiple OpSB ops. - // Regalloc gets very confused otherwise. - var sb *Value - outer: - for _, b := range f.Blocks { - for _, v := range b.Values { - if v.Op == OpSB { - sb = v - break outer - } - } - } - if sb == nil { - return - } - for _, b := range f.Blocks { - for _, v := range b.Values { - for i, a := range v.Args { - if a.Op == OpSB { - v.Args[i] = sb - } - } - } - } - return - } // Two values are equivalent if they satisfy the following definition: // equivalent(v, w): // v.op == w.op @@ -77,6 +49,14 @@ func cse(f *Func) { } } for i, e := range partition { + if Debug > 1 && len(e) > 500 { + fmt.Printf("CSE.large partition (%d): ", len(e)) + for j := 0; j < 3; j++ { + fmt.Printf("%s ", e[j].LongString()) + } + fmt.Println() + } + for _, v := range e { valueEqClass[v.ID] = ID(i) } |