aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKeith Randall <khr@google.com>2018-01-23 13:06:21 -0800
committerKeith Randall <khr@golang.org>2018-01-23 21:51:55 +0000
commit7eaa8efbe4bb63ca486aab61f83287dd4bf1d609 (patch)
tree14a8b608e3707d249e7edd4f28f38f8d3005e31f /lib
parentf27a1ff2c8ba1dce874e76d0b82c059b38a731d3 (diff)
downloadgo-7eaa8efbe4bb63ca486aab61f83287dd4bf1d609.tar.gz
go-7eaa8efbe4bb63ca486aab61f83287dd4bf1d609.zip
cmd/compile: don't let spills clobber arguments
The compiler allows code to have multiple differently-typed views of a single argument. For instance, if we have func f(x float64) { y := *(*int64)(unsafe.Pointer(&x)) ... } Then in SSA we get two OpArg ops, one with float64 type and one with int64 type. The compiler will try to reuse argument slots for spill slots. It checks that the argument slot is dead by consulting an interference graph. When building the interference graph, we normally ignore cross-type edges because the values on either end of that edge can't be allocated to the same slot. (This is just a space-saving optimization.) This rule breaks down when one of the values is an argument, because of the multiple views described above. If we're spilling a float64, it is not enough that the float64 version of x is dead; the int64 version of x has to be dead also. Remove the optimization of not recording interference edges if types don't match. That optimization is incorrect if one of the values connected by the edge is an argument. Fixes #23522 Change-Id: I361f85d80fe3bc7249014ca2c3ec887c3dc30271 Reviewed-on: https://go-review.googlesource.com/89335 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions