• Giovanni Bajo's avatar
    cmd/compile: in prove, complete support for OpIsInBounds/OpIsSliceInBounds · ac43de3a
    Giovanni Bajo authored
    The logic in addBranchRestrictions didn't allow to correctly
    model OpIs(Slice)Bound for signed domain, and it was also partly
    implemented within addRestrictions.
    
    Thanks to the previous changes, it is now possible to handle
    the negative conditions correctly, so that we can learn
    both signed/LT + unsigned/LT on the positive side, and
    signed/GE + unsigned/GE on the negative side (but only if
    the index can be proved to be non-negative).
    
    This is able to prove ~50 more slice accesses in std+cmd.
    
    Change-Id: I9858080dc03b16f85993a55983dbc4b00f8491b0
    Reviewed-on: https://go-review.googlesource.com/104037
    Run-TryBot: Giovanni Bajo <rasky@develer.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarAustin Clements <austin@google.com>
    ac43de3a
prove.go 9.5 KB