• Alexandru Moșoi's avatar
    [dev.ssa] cmd/compile/internal/ssa: remove proven redundant controls. · bdea1d58
    Alexandru Moșoi authored
    * It does very simple bounds checking elimination. E.g.
    removes the second check in for i := range a { a[i]++; a[i++]; }
    * Improves on the following redundant expression:
    return a6 || (a6 || (a6 || a4)) || (a6 || (a4 || a6 || (false || a6)))
    * Linear in the number of block edges.
    
    I patched in CL 12960 that does bounds, nil and constant propagation
    to make sure this CL is not just redundant. Size of pkg/tool/linux_amd64/*
    (excluding compile which is affected by this change):
    
    With IsInBounds and IsSliceInBounds
    -this -12960 92285080
    +this -12960 91947416
    -this +12960 91978976
    +this +12960 91923088
    
    Gain is ~110% of 12960.
    
    Without IsInBounds and IsSliceInBounds (older run)
    -this -12960 95515512
    +this -12960 95492536
    -this +12960 95216920
    +this +12960 95204440
    
    Shaves 22k on its own.
    
    * Can we handle IsInBounds better with this? In
    for i := range a { a[i]++; } the bounds checking at a[i]
    is not eliminated.
    
    Change-Id: I98957427399145fb33693173fd4d5a8d71c7cc20
    Reviewed-on: https://go-review.googlesource.com/19710Reviewed-by: default avatarDavid Chase <drchase@google.com>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    Run-TryBot: Alexandru Moșoi <alexandru@mosoi.ro>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    bdea1d58
prove.go 9.37 KB