• David Chase's avatar
    cmd/compile: use Block.Likely to put likely branch first · ab48574b
    David Chase authored
    When a neither of a conditional block's successors follows,
    the block must end with a conditional branch followed by a
    an unconditional branch.  If the (conditional) branch is
    "unlikely", invert it and swap successors to make it
    likely instead.
    
    This doesn't matter to most benchmarks on amd64, but in one
    instance on amd64 it caused a 30% improvement, and it is
    otherwise harmless.  The problematic loop is
    
    		for i := 0; i < w; i++ {
    			if pw[i] != 0 {
    				return true
    			}
    		}
    
    compiled under GOEXPERIMENT=preemptibleloops
    This the very worst-case benchmark for that experiment.
    
    Also in this CL is a commoning up of heavily-repeated
    boilerplate, which made it much easier to see that the
    changes were applied correctly.  In the future this should
    allow un-exporting of SSAGenState.Branches once the
    boilerplate-replacement is done everywhere.
    
    Change-Id: I0e5ded6eeb3ab1e3e0138e12d54c7e056bd99335
    Reviewed-on: https://go-review.googlesource.com/104977
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
    ab48574b
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
buildid Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
test2json Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...