• Russ Cox's avatar
    cmd/gc: synthesize zeroed value for non-assignment context · 5225854b
    Russ Cox authored
    CL 157910047 introduced code to turn a node representing
    a zeroed composite literal into N, the nil Node* pointer
    (which represents any zero, not the Go literal nil).
    
    That's great for assignments like x = T{}, but it doesn't work
    when T{} is used in a value context like T{}.v or x == T{}.
    Fix those.
    
    Should have no effect on performance; confirmed.
    The deltas below are noise (compare ns/op):
    
    benchmark                          old ns/op      new ns/op      delta
    BenchmarkBinaryTree17              2902919192     2915228424     +0.42%
    BenchmarkFannkuch11                2597417605     2630363685     +1.27%
    BenchmarkFmtFprintfEmpty           73.7           74.8           +1.49%
    BenchmarkFmtFprintfString          196            199            +1.53%
    BenchmarkFmtFprintfInt             213            217            +1.88%
    BenchmarkFmtFprintfIntInt          336            356            +5.95%
    BenchmarkFmtFprintfPrefixedInt     289            294            +1.73%
    BenchmarkFmtFprintfFloat           415            416            +0.24%
    BenchmarkFmtManyArgs               1281           1271           -0.78%
    BenchmarkGobDecode                 10271734       10307978       +0.35%
    BenchmarkGobEncode                 8985021        9079442        +1.05%
    BenchmarkGzip                      410233227      412266944      +0.50%
    BenchmarkGunzip                    102114554      103272443      +1.13%
    BenchmarkHTTPClientServer          45297          44993          -0.67%
    BenchmarkJSONEncode                19499741       19498489       -0.01%
    BenchmarkJSONDecode                76436733       74247497       -2.86%
    BenchmarkMandelbrot200             4273814        4307292        +0.78%
    BenchmarkGoParse                   4024594        4028937        +0.11%
    BenchmarkRegexpMatchEasy0_32       131            135            +3.05%
    BenchmarkRegexpMatchEasy0_1K       328            333            +1.52%
    BenchmarkRegexpMatchEasy1_32       115            117            +1.74%
    BenchmarkRegexpMatchEasy1_1K       931            948            +1.83%
    BenchmarkRegexpMatchMedium_32      216            217            +0.46%
    BenchmarkRegexpMatchMedium_1K      72669          72857          +0.26%
    BenchmarkRegexpMatchHard_32        3818           3809           -0.24%
    BenchmarkRegexpMatchHard_1K        121398         121945         +0.45%
    BenchmarkRevcomp                   613996550      615145436      +0.19%
    BenchmarkTemplate                  93678525       93267391       -0.44%
    BenchmarkTimeParse                 414            411            -0.72%
    BenchmarkTimeFormat                396            399            +0.76%
    
    Fixes #8947.
    
    LGTM=r
    R=r, dave
    CC=golang-codereviews
    https://golang.org/cl/162130043
    5225854b
Name
Last commit
Last update
..
Makefile Loading commit data...
align.c Loading commit data...
array.c Loading commit data...
bisonerrors Loading commit data...
bits.c Loading commit data...
builtin.c Loading commit data...
bv.c Loading commit data...
closure.c Loading commit data...
const.c Loading commit data...
cplx.c Loading commit data...
dcl.c Loading commit data...
doc.go Loading commit data...
esc.c Loading commit data...
export.c Loading commit data...
fmt.c Loading commit data...
gen.c Loading commit data...
go.errors Loading commit data...
go.h Loading commit data...
go.y Loading commit data...
init.c Loading commit data...
inl.c Loading commit data...
lex.c Loading commit data...
md5.c Loading commit data...
md5.h Loading commit data...
mkbuiltin Loading commit data...
mkbuiltin1.c Loading commit data...
mkopnames Loading commit data...
mparith1.c Loading commit data...
mparith2.c Loading commit data...
mparith3.c Loading commit data...
obj.c Loading commit data...
order.c Loading commit data...
pgen.c Loading commit data...
plive.c Loading commit data...
popt.c Loading commit data...
popt.h Loading commit data...
racewalk.c Loading commit data...
range.c Loading commit data...
reflect.c Loading commit data...
runtime.go Loading commit data...
select.c Loading commit data...
sinit.c Loading commit data...
subr.c Loading commit data...
swt.c Loading commit data...
typecheck.c Loading commit data...
unsafe.c Loading commit data...
unsafe.go Loading commit data...
walk.c Loading commit data...
y.tab.c Loading commit data...
y.tab.h Loading commit data...
yerr.h Loading commit data...