From: Keith Randall Date: Tue, 20 Oct 2015 01:44:50 +0000 (-0700) Subject: [dev.ssa] cmd/compile: don't move mem-using values in tighten pass X-Git-Tag: go1.7beta1~1623^2^2~136 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=65df9c4c2b6750f207b71e65a01b2b16de7d3b61;p=gostls13.git [dev.ssa] cmd/compile: don't move mem-using values in tighten pass 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 Run-TryBot: David Chase --- diff --git a/src/cmd/compile/internal/ssa/tighten.go b/src/cmd/compile/internal/ssa/tighten.go index 05c349cc17..1da5071a2a 100644 --- a/src/cmd/compile/internal/ssa/tighten.go +++ b/src/cmd/compile/internal/ssa/tighten.go @@ -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,