]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile: don't move mem-using values in tighten pass
authorKeith Randall <khr@golang.org>
Tue, 20 Oct 2015 01:44:50 +0000 (18:44 -0700)
committerKeith Randall <khr@golang.org>
Tue, 20 Oct 2015 02:09:52 +0000 (02:09 +0000)
It isn't safe, the place where we're moving the value to
might have a different live memory.  Moving will introduce
two simultaneously live memories.

Change-Id: I07e61a6db8ef285088c530dc2e5d5768d27871ff
Reviewed-on: https://go-review.googlesource.com/16099
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>

src/cmd/compile/internal/ssa/tighten.go

index 05c349cc178db3f8015b4e21370d960bc76cbd2f..1da5071a2ac087cda78dd4f26d09e4382ab98d67 100644 (file)
@@ -58,6 +58,11 @@ func tighten(f *Func) {
                                        // GetClosurePtr must stay in entry block
                                        continue
                                }
+                               if len(v.Args) > 0 && v.Args[len(v.Args)-1].Type.IsMemory() {
+                                       // We can't move values which have a memory arg - it might
+                                       // make two memory values live across a block boundary.
+                                       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,