• Russ Cox's avatar
    cmd/gc: relax address-of escape analysis · e5d742fc
    Russ Cox authored
    Make the loop nesting depth of &x depend on where x is declared,
    not on where the &x appears. The latter is only a conservative
    estimate of the former. Being more careful can avoid some
    variables escaping, and it is easier to reason about.
    
    It would have avoided issue 7313, although that was still a bug
    worth fixing.
    
    Not much effect in the tree: one variable in the whole tree
    is saved from a heap allocation (something in x509 parsing).
    
    LGTM=daniel.morsing
    R=daniel.morsing
    CC=golang-codereviews
    https://golang.org/cl/62380043
    e5d742fc
escape2.go 26.3 KB