• Keith Randall's avatar
    cmd/compile: redo nil checks · 3134ab3c
    Keith Randall authored
    Get rid of BlockCheck. Josh goaded me into it, and I went
    down a rabbithole making it happen.
    
    NilCheck now panics if the pointer is nil and returns void, as before.
    BlockCheck is gone, and NilCheck is no longer a Control value for
    any block. It just exists (and deadcode knows not to throw it away).
    
    I rewrote the nilcheckelim pass to handle this case.  In particular,
    there can now be multiple NilCheck ops per block.
    
    I moved all of the arch-dependent nil check elimination done as
    part of ssaGenValue into its own proper pass, so we don't have to
    duplicate that code for every architecture.
    
    Making the arch-dependent nil check its own pass means I needed
    to add a bunch of flags to the opcode table so I could write
    the code without arch-dependent ops everywhere.
    
    Change-Id: I419f891ac9b0de313033ff09115c374163416a9f
    Reviewed-on: https://go-review.googlesource.com/29120
    Run-TryBot: Keith Randall <khr@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarDavid Chase <drchase@google.com>
    3134ab3c
deadcode.go 6.48 KB