]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: store call args in the call block
authorCherry Zhang <cherryyz@google.com>
Wed, 7 Oct 2020 15:32:43 +0000 (11:32 -0400)
committerDavid Chase <drchase@google.com>
Wed, 7 Oct 2020 15:57:48 +0000 (15:57 +0000)
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 <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/expand_calls.go

index 992936b2d3d33d2eb1017d049934ec2606389c97..8c06040542e6f23bfe60353ea83e2b3cadb765c0 100644 (file)
@@ -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 {