• Russ Cox's avatar
    cmd/5g etc: mechanical cleanup · 79f727a7
    Russ Cox authored
    Run rsc.io/grind rev a26569f on C->Go conversions.
    
    The new change in grind is the inlining of goto targets.
    If code says 'goto x' and the block starting at label x is unreachable
    except through that goto and the code can be moved to where
    the goto is without changing the meaning of its variable names,
    grind does that move. Simlarly, a goto to a plain return statement
    turns into that return statement (even if there are other paths to
    the return statement).
    
    Combined, these remove many long-distance gotos, which in turn
    makes it possible to reduce the scope of more variable declarations.
    (Because gotos can't jump across declarations, the gotos were
    keeping the declarations from moving.)
    
    Checked bit-for-bit compatibility with toolstash + buildall.
    
    Reduces compiler runtime in html/template by about 12%.
    
    Change-Id: Id727c0bd7763a61aa22f3daa00aeb8fccbc057a3
    Reviewed-on: https://go-review.googlesource.com/6472Reviewed-by: 's avatarAram Hăvărneanu <aram@mgk.ro>
    Reviewed-by: 's avatarDmitry Vyukov <dvyukov@google.com>
    79f727a7
util.go 6.08 KB