• 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
..
builtin Loading commit data...
testdata Loading commit data...
alg.go Loading commit data...
align.go Loading commit data...
asm_test.go Loading commit data...
bexport.go Loading commit data...
bimport.go Loading commit data...
bitset.go Loading commit data...
bootstrap.go Loading commit data...
builtin.go Loading commit data...
builtin_test.go Loading commit data...
bv.go Loading commit data...
class_string.go Loading commit data...
closure.go Loading commit data...
const.go Loading commit data...
constFold_test.go Loading commit data...
dcl.go Loading commit data...
dwinl.go Loading commit data...
esc.go Loading commit data...
export.go Loading commit data...
fixedbugs_test.go Loading commit data...
float_test.go Loading commit data...
fmt.go Loading commit data...
gen.go Loading commit data...
global_test.go Loading commit data...
go.go Loading commit data...
gsubr.go Loading commit data...
iface_test.go Loading commit data...
init.go Loading commit data...
inl.go Loading commit data...
inl_test.go Loading commit data...
lex.go Loading commit data...
lex_test.go Loading commit data...
logic_test.go Loading commit data...
main.go Loading commit data...
mkbuiltin.go Loading commit data...
mpfloat.go Loading commit data...
mpint.go Loading commit data...
noder.go Loading commit data...
norace.go Loading commit data...
obj.go Loading commit data...
op_string.go Loading commit data...
order.go Loading commit data...
pgen.go Loading commit data...
pgen_test.go Loading commit data...
phi.go Loading commit data...
plive.go Loading commit data...
pprof.go Loading commit data...
race.go Loading commit data...
racewalk.go Loading commit data...
range.go Loading commit data...
reflect.go Loading commit data...
reproduciblebuilds_test.go Loading commit data...
scope.go Loading commit data...
scope_test.go Loading commit data...
select.go Loading commit data...
shift_test.go Loading commit data...
sinit.go Loading commit data...
sizeof_test.go Loading commit data...
ssa.go Loading commit data...
ssa_test.go Loading commit data...
subr.go Loading commit data...
swt.go Loading commit data...
swt_test.go Loading commit data...
syntax.go Loading commit data...
timings.go Loading commit data...
trace.go Loading commit data...
truncconst_test.go Loading commit data...
typecheck.go Loading commit data...
types.go Loading commit data...
types_acc.go Loading commit data...
universe.go Loading commit data...
unsafe.go Loading commit data...
util.go Loading commit data...
walk.go Loading commit data...