aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/expand_calls.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-03-29 20:14:51 -0400
committerDavid Chase <drchase@google.com>2021-03-31 14:10:11 +0000
commitca3aefc4a96f2e26c7bed549a6c90b6f12c1ecea (patch)
treea363d9ff7b99aba9c97a6e10efe8e0103456659e /src/cmd/compile/internal/ssa/expand_calls.go
parentc847932804467f511b0e123cf29b72dd0d509306 (diff)
downloadgo-ca3aefc4a96f2e26c7bed549a6c90b6f12c1ecea.tar.gz
go-ca3aefc4a96f2e26c7bed549a6c90b6f12c1ecea.zip
cmd/compile: make expandCalls preserve types of pointer stores
This is accomplished by checking for simple stores of pointer types and leaving them alone. The failure case was when a *mspan (not in heap) stored type was replaced by unsafe.Pointer. Updates #40724. Change-Id: I529e1705bf58fb0e64e60d48fd550b3a407e57e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/305672 Trust: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/expand_calls.go')
-rw-r--r--src/cmd/compile/internal/ssa/expand_calls.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/ssa/expand_calls.go b/src/cmd/compile/internal/ssa/expand_calls.go
index 3444097ae3..b6aba0ed16 100644
--- a/src/cmd/compile/internal/ssa/expand_calls.go
+++ b/src/cmd/compile/internal/ssa/expand_calls.go
@@ -1114,6 +1114,9 @@ func expandCalls(f *Func) {
for _, v := range b.Values {
if v.Op == OpStore {
t := v.Aux.(*types.Type)
+ if t.IsPtrShaped() { // Everything already fits, and this ensures pointer type properties aren't discarded (e.g, notinheap)
+ continue
+ }
source := v.Args[1]
tSrc := source.Type
iAEATt := x.isAlreadyExpandedAggregateType(t)
@@ -1422,7 +1425,7 @@ func (x *expandState) newArgToMemOrRegs(baseArg, toReplace *Value, offset int64,
if x.debug {
x.indent(3)
defer x.indent(-3)
- x.Printf("newArgToMemOrRegs(base=%s; toReplace=%s; t=%s; memOff=%d; regOff=%d)\n", baseArg.String(), toReplace.LongString(), t, offset, regOffset)
+ x.Printf("newArgToMemOrRegs(base=%s; toReplace=%s; t=%s; memOff=%d; regOff=%d)\n", baseArg.String(), toReplace.LongString(), t.String(), offset, regOffset)
}
key := selKey{baseArg, offset, t.Width, t}
w := x.commonArgs[key]