mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 23:43:40 +00:00
transform: handle returned pointer alloc aliases
Follow returned pointer aliases when deciding whether runtime.alloc calls can be lowered to stack allocations. A returned parameter is not the same as nocapture: it still flows back to the caller and must be checked as an alias of the original allocation. Keep the analysis conservative for recursive returned-parameter chains and unknown operands. The existing golden test now shows that the non-escaping returned pointer cases no longer require heap allocation.
This commit is contained in:
Vendored
-2
@@ -1,4 +1,3 @@
|
||||
testdata/allocs2.go:12.1,12.9 1 0
|
||||
testdata/allocs2.go:21.1,21.22 1 0
|
||||
testdata/allocs2.go:24.1,24.43 1 0
|
||||
testdata/allocs2.go:26.1,26.25 1 0
|
||||
@@ -8,7 +7,6 @@ testdata/allocs2.go:44.1,44.23 1 0
|
||||
testdata/allocs2.go:46.1,46.22 1 0
|
||||
testdata/allocs2.go:49.1,49.9 1 0
|
||||
testdata/allocs2.go:50.1,50.9 1 0
|
||||
testdata/allocs2.go:98.1,98.23 1 0
|
||||
testdata/allocs2.go:107.1,107.21 1 0
|
||||
testdata/allocs2.go:114.1,114.23 1 0
|
||||
testdata/allocs2.go:128.1,128.23 1 0
|
||||
|
||||
Reference in New Issue
Block a user