main.go:12:2: l3 escapes to heap:
main.go:12:2: flow: ~r1 = &l3:
main.go:12:2: from &l3 (address-of) at main.go:13:9
main.go:12:2: from return &l3, arg.Name == string(“Java”) (return) at main.go:13:2
main.go:7:21: parameter arg leaks to l3 with derefs=0:
main.go:7:21: flow: l1 = arg:
main.go:7:21: from l1 := arg (assign) at main.go:8:5
main.go:7:21: flow: l2 = &l1:
main.go:7:21: from &l1 (address-of) at main.go:11:8
main.go:7:21: from l2 := &l1 (assign) at main.go:11:5
main.go:7:21: flow: l3 = *l2:
main.go:7:21: from *l2 (indirection) at main.go:12:8
main.go:7:21: from l3 := *l2 (assign) at main.go:12:5
main.go:7:21: leaking param: arg
main.go:12:2: moved to heap: l3
其中 -m -m 与 -m=2 效果一样,当 -m=4 时,日志还会打印出内联前后的 IR Tree 结构,读者可以自己尝试。