From ccf89bef43f3580526019e0804e91352e62047d5 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 7 Oct 2020 11:32:43 -0400 Subject: [PATCH] cmd/compile: store call args in the call block We already do this for OpStore, but we didn't do this for OpMove. Do the same, to ensure that no two memories are live at the same time. Fixes #41846. Change-Id: Iad77ff031b3c4459d1217e0b04aeb0e692eb474d Reviewed-on: https://go-review.googlesource.com/c/go/+/260237 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: David Chase --- src/cmd/compile/internal/ssa/expand_calls.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/compile/internal/ssa/expand_calls.go b/src/cmd/compile/internal/ssa/expand_calls.go index 992936b2d3..8c06040542 100644 --- a/src/cmd/compile/internal/ssa/expand_calls.go +++ b/src/cmd/compile/internal/ssa/expand_calls.go @@ -283,7 +283,7 @@ func expandCalls(f *Func) { // TODO this will be more complicated with registers in the picture. src := a.Args[0] dst := f.ConstOffPtrSP(src.Type, aux.OffsetOfArg(auxI), sp) - if a.Uses == 1 { + if a.Uses == 1 && a.Block == v.Block { a.reset(OpMove) a.Pos = pos a.Type = types.TypeMem @@ -292,7 +292,7 @@ func expandCalls(f *Func) { a.SetArgs3(dst, src, mem) mem = a } else { - mem = a.Block.NewValue3A(pos, OpMove, types.TypeMem, aux.TypeOfArg(auxI), dst, src, mem) + mem = v.Block.NewValue3A(pos, OpMove, types.TypeMem, aux.TypeOfArg(auxI), dst, src, mem) mem.AuxInt = aux.SizeOfArg(auxI) } } else { -- 2.50.0