diff options
author | Austin Clements <austin@google.com> | 2014-11-03 15:48:51 -0500 |
---|---|---|
committer | Austin Clements <austin@google.com> | 2014-11-03 15:48:51 -0500 |
commit | 56a0d66982aa63a0fe093f4182c05728f8000887 (patch) | |
tree | 2a139ac84a08cdec039fd34b7c8fa1c7b5e84e39 /src/cmd | |
parent | a99ecf3e88b4af2999b94cc7195cb64c8e7addcd (diff) | |
download | go-56a0d66982aa63a0fe093f4182c05728f8000887.tar.gz |
[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://codereview.appspot.com/168120043
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/9g/peep.c | 4 | ||||
-rw-r--r-- | src/cmd/gc/popt.c | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/cmd/9g/peep.c b/src/cmd/9g/peep.c index 5721d7b04..ec314d633 100644 --- a/src/cmd/9g/peep.c +++ b/src/cmd/9g/peep.c @@ -44,13 +44,15 @@ peep(Prog *p) void excise(Flow *r) { - Prog *p; + Prog *p, *l; p = r->prog; if(debug['P'] && debug['v']) print("%P ===delete===\n", p); + l = p->link; *p = zprog; p->as = ANOP; + p->link = l; ostats.ndelmov++; } diff --git a/src/cmd/gc/popt.c b/src/cmd/gc/popt.c index 6e6db88ef..993bb2482 100644 --- a/src/cmd/gc/popt.c +++ b/src/cmd/gc/popt.c @@ -847,10 +847,6 @@ nilopt(Prog *firstp) Graph *g; int ncheck, nkill; - // TODO(minux): nilopt on power64 throw away seemly random segment of code. - if(thechar == '9') - return; - g = flowstart(firstp, sizeof(NilFlow)); if(g == nil) return; |