]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: don't move OpSP and OpSB values
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 5 Aug 2015 23:11:57 +0000 (16:11 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 6 Aug 2015 17:20:43 +0000 (17:20 +0000)
regalloc expects to find all OpSP and OpSB values
in the entry block.

There is no value to moving them; don't.

Change-Id: I775198f03ce7420348721ffc5e7d2bab065465b1
Reviewed-on: https://go-review.googlesource.com/13266
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/regalloc.go
src/cmd/compile/internal/ssa/tighten.go

index dac107dd18459336e96d873e667418e556fcc6f7..9056531634f1b53a9e4e5de8f6e928345c69ca78 100644 (file)
@@ -101,7 +101,8 @@ func regalloc(f *Func) {
 
        var oldSched []*Value
 
-       // Hack to find sp and sb Values and assign them a register. (TODO: make not so hacky)
+       // Hack to find sp and sb Values and assign them a register.
+       // TODO: make not so hacky; update the tighten pass when this is done
        var sp, sb *Value
        for _, v := range f.Entry.Values {
                switch v.Op {
index a43218095e615094f2692dfc838e56ebaf94d77e..02b1f701f58333d380649e80d1cd4871b2c5cd43 100644 (file)
@@ -57,6 +57,13 @@ func tighten(f *Func) {
                                if v.Op == OpPhi {
                                        continue
                                }
+                               if v.Op == OpSB || v.Op == OpSP {
+                                       // regalloc expects OpSP and OpSB values to be in the entry block,
+                                       // so don't move them.
+                                       // TODO: Handle this more gracefully in regalloc and
+                                       // remove this restriction.
+                                       continue
+                               }
                                if uses[v.ID] == 1 && !phi[v.ID] && home[v.ID] != b && len(v.Args) < 2 {
                                        // v is used in exactly one block, and it is not b.
                                        // Furthermore, it takes at most one input,