mirror of
https://github.com/golang/go
synced 2024-11-19 03:34:41 -07:00
[dev.power64] 9g: fix nilopt
Previously, nilopt was disabled on power64x because it threw away "seemly random segments of code." Indeed, excise on power64x failed to preserve the link field, so it excised not only the requested instruction but all following instructions in the function. Fix excise to retain the link field while otherwise zeroing the instruction. This makes nilopt safe on power64x. It still fails nilptr3.go's tests for removal of repeated nil checks because those depend on also optimizing away repeated loads, which doesn't currently happen on power64x. LGTM=dave, rsc R=rsc, dave CC=golang-codereviews https://golang.org/cl/168120043
This commit is contained in:
parent
31b1207fde
commit
810019286f
@ -44,13 +44,15 @@ peep(Prog *p)
|
|||||||
void
|
void
|
||||||
excise(Flow *r)
|
excise(Flow *r)
|
||||||
{
|
{
|
||||||
Prog *p;
|
Prog *p, *l;
|
||||||
|
|
||||||
p = r->prog;
|
p = r->prog;
|
||||||
if(debug['P'] && debug['v'])
|
if(debug['P'] && debug['v'])
|
||||||
print("%P ===delete===\n", p);
|
print("%P ===delete===\n", p);
|
||||||
|
l = p->link;
|
||||||
*p = zprog;
|
*p = zprog;
|
||||||
p->as = ANOP;
|
p->as = ANOP;
|
||||||
|
p->link = l;
|
||||||
ostats.ndelmov++;
|
ostats.ndelmov++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,10 +847,6 @@ nilopt(Prog *firstp)
|
|||||||
Graph *g;
|
Graph *g;
|
||||||
int ncheck, nkill;
|
int ncheck, nkill;
|
||||||
|
|
||||||
// TODO(minux): nilopt on power64 throw away seemly random segment of code.
|
|
||||||
if(thechar == '9')
|
|
||||||
return;
|
|
||||||
|
|
||||||
g = flowstart(firstp, sizeof(NilFlow));
|
g = flowstart(firstp, sizeof(NilFlow));
|
||||||
if(g == nil)
|
if(g == nil)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user