diff options
author | Keith Randall <khr@golang.org> | 2018-10-06 14:31:08 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2018-10-15 16:07:52 +0000 |
commit | 63e964e1741277c4da004e366111243f9ec942a2 (patch) | |
tree | d2ccfb193c1a30c3dab28e58bbef3b46ece19697 /test/live.go | |
parent | 296b7aeae0b3231f2e943859b37108e5f9e130d3 (diff) | |
download | go-63e964e1741277c4da004e366111243f9ec942a2.tar.gz go-63e964e1741277c4da004e366111243f9ec942a2.zip |
cmd/compile: provide types for all order-allocated temporaries
Ensure that we correctly type the stack temps for regular closures,
method function closures, and slice literals.
Then we don't need to override the dummy types later.
Furthermore, this allows order to reuse temporaries of these types.
OARRAYLIT doesn't need a temporary as far as I can tell, so I
removed that case from order.
Change-Id: Ic58520fa50c90639393ff78f33d3c831d5c4acb9
Reviewed-on: https://go-review.googlesource.com/c/140306
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/live.go')
-rw-r--r-- | test/live.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/test/live.go b/test/live.go index 6367cab96f..a508947afc 100644 --- a/test/live.go +++ b/test/live.go @@ -404,8 +404,8 @@ func f27(b bool) { if b { call27(func() { x++ }) // ERROR "stack object .autotmp_[0-9]+ struct \{" } - call27(func() { x++ }) // ERROR "stack object .autotmp_[0-9]+ struct \{" - call27(func() { x++ }) // ERROR "stack object .autotmp_[0-9]+ struct \{" + call27(func() { x++ }) + call27(func() { x++ }) printnl() } @@ -521,8 +521,8 @@ func f32(b bool) { if b { call32(t32.Inc) // ERROR "stack object .autotmp_[0-9]+ struct \{" } - call32(t32.Inc) // ERROR "stack object .autotmp_[0-9]+ struct \{" - call32(t32.Inc) // ERROR "stack object .autotmp_[0-9]+ struct \{" + call32(t32.Inc) + call32(t32.Inc) } //go:noescape @@ -694,3 +694,12 @@ func f41(p, q *int) (r *int) { // ERROR "live at entry to f41: p q$" r = q return // ERROR "live at call to deferreturn: r$" } + +func f42() { + var p, q, r int + f43([]*int{&p,&q,&r}) // ERROR "stack object .autotmp_[0-9]+ \[3\]\*int$" + f43([]*int{&p,&r,&q}) + f43([]*int{&q,&p,&r}) +} +//go:noescape +func f43(a []*int) |