• Austin Clements's avatar
    cmd/compile: add fence-post implications to prove · 6436270d
    Austin Clements authored
    This adds four new deductions to the prove pass, all related to adding
    or subtracting one from a value. This is the first hint of actual
    arithmetic relations in the prove pass.
    
    The most effective of these is
    
       x-1 >= w && x > min  ⇒  x > w
    
    This helps eliminate bounds checks in code like
    
      if x > 0 {
        // do something with s[x-1]
      }
    
    Altogether, these deductions prove an additional 260 branches in std
    and cmd. Furthermore, they will let us eliminate some tricky
    compiler-inserted panics in the runtime that are interfering with
    static analysis.
    
    Fixes #23354.
    
    Change-Id: I7088223e0e0cd6ff062a75c127eb4bb60e6dce02
    Reviewed-on: https://go-review.googlesource.com/87480Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    Reviewed-by: 's avatarAlexandru Moșoi <alexandru@mosoi.ro>
    6436270d
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...