]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] fix equivalence class after aux/auxint refactor.
authorDaniel Morsing <daniel.morsing@gmail.com>
Sun, 14 Jun 2015 22:06:39 +0000 (23:06 +0100)
committerDaniel Morsing <daniel.morsing@gmail.com>
Mon, 15 Jun 2015 12:06:05 +0000 (12:06 +0000)
This caused the following code snippet to be miscompiled

var f int
x := g(&f)
f = 10

Moving the store of 10 above the function call.

Change-Id: Ic6951f5e7781b122cd881df324a38e519d6d66f0
Reviewed-on: https://go-review.googlesource.com/11073
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/cse.go

index aba24aeabcd59c25e2304a6fe7fede990c4f597a..660712612a151409613378f27ea0e8142ff5e381 100644 (file)
@@ -26,15 +26,16 @@ func cse(f *Func) {
        // Make initial partition based on opcode/type/aux/nargs
        // TODO(khr): types are not canonical, so we may split unnecessarily.  Fix that.
        type key struct {
-               op    Op
-               typ   Type
-               aux   interface{}
-               nargs int
+               op     Op
+               typ    Type
+               aux    interface{}
+               auxint int64
+               nargs  int
        }
        m := map[key]eqclass{}
        for _, b := range f.Blocks {
                for _, v := range b.Values {
-                       k := key{v.Op, v.Type, v.Aux, len(v.Args)}
+                       k := key{v.Op, v.Type, v.Aux, v.AuxInt, len(v.Args)}
                        m[k] = append(m[k], v)
                }
        }