From 65df9c4c2b6750f207b71e65a01b2b16de7d3b61 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Mon, 19 Oct 2015 18:44:50 -0700 Subject: [PATCH] [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 --- src/cmd/compile/internal/ssa/tighten.go | 5 +++++ 1 file changed, 5 insertions(+) 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, -- 2.48.1