Better to avoid the memory loads and just use immediate constants.
This especially applies to zeroing, which was being done by
copying zeros from elsewhere in the binary, even if the value
was going to be completely initialized with non-zero values.
The zero writes were optimized away but the zero loads from
the data segment were not.
LGTM=r
R=r, bradfitz, dvyukov
CC=golang-codereviews
https://golang.org/cl/
152700045
if(t->etype != TSTRUCT)
fatal("anylit: not struct");
- if(simplename(var)) {
+ if(simplename(var) && count(n->list) > 4) {
if(ctxt == 0) {
// lay out static data
}
// initialize of not completely specified
- if(count(n->list) < structcount(t)) {
+ if(simplename(var) || count(n->list) < structcount(t)) {
a = nod(OAS, var, N);
typecheck(&a, Etop);
walkexpr(&a, init);
break;
}
- if(simplename(var)) {
+ if(simplename(var) && count(n->list) > 4) {
if(ctxt == 0) {
// lay out static data
}
// initialize of not completely specified
- if(count(n->list) < t->bound) {
+ if(simplename(var) || count(n->list) < t->bound) {
a = nod(OAS, var, N);
typecheck(&a, Etop);
walkexpr(&a, init);