diff --git a/src/cmd/5g/peep.c b/src/cmd/5g/peep.c index be13756a02..f96804d73d 100644 --- a/src/cmd/5g/peep.c +++ b/src/cmd/5g/peep.c @@ -63,8 +63,6 @@ peep(Prog *firstp) g = flowstart(firstp, sizeof(Flow)); if(g == nil) return; - for(r=g->start, t=0; r!=nil; r=r->link, t++) - r->active = t; loop1: if(debug['P'] && debug['v']) @@ -345,9 +343,6 @@ gotit: return 1; } -static uchar *active; -static int nactive; - /* * The idea is to remove redundant copies. * v1->v2 F=0 @@ -365,17 +360,15 @@ copyprop(Graph *g, Flow *r0) { Prog *p; Adr *v1, *v2; + Flow *r; p = r0->prog; v1 = &p->from; v2 = &p->to; if(copyas(v1, v2)) return 1; - if(nactive < g->num) { - nactive = g->num; - active = realloc(active, g->num); - } - memset(active, 0, g->num); + for(r=g->start; r!=nil; r=r->link) + r->active = 0; return copy1(v1, v2, r0->s1, 0); } @@ -385,12 +378,12 @@ copy1(Adr *v1, Adr *v2, Flow *r, int f) int t; Prog *p; - if(active[r->active]) { + if(r->active) { if(debug['P']) print("act set; return 1\n"); return 1; } - active[r->active] = 1; + r->active = 1; if(debug['P']) print("copy %D->%D f=%d\n", v1, v2, f); for(; r != nil; r = r->s1) { diff --git a/src/cmd/6g/peep.c b/src/cmd/6g/peep.c index f03ab83d68..9b935ded8b 100644 --- a/src/cmd/6g/peep.c +++ b/src/cmd/6g/peep.c @@ -92,8 +92,6 @@ peep(Prog *firstp) g = flowstart(firstp, sizeof(Flow)); if(g == nil) return; - for(r=g->start, t=0; r!=nil; r=r->link, t++) - r->active = t; // byte, word arithmetic elimination. elimshortmov(g); @@ -288,7 +286,7 @@ loop1: pushback(r); } } - + flowend(g); } @@ -628,9 +626,6 @@ gotit: return 1; } -static uchar *active; -static int nactive; - /* * The idea is to remove redundant copies. * v1->v2 F=0 @@ -648,6 +643,7 @@ copyprop(Graph *g, Flow *r0) { Prog *p; Adr *v1, *v2; + Flow *r; if(debug['P'] && debug['v']) print("copyprop %P\n", r0->prog); @@ -656,11 +652,8 @@ copyprop(Graph *g, Flow *r0) v2 = &p->to; if(copyas(v1, v2)) return 1; - if(nactive < g->num) { - nactive = g->num; - active = realloc(active, g->num); - } - memset(active, 0, g->num); + for(r=g->start; r!=nil; r=r->link) + r->active = 0; return copy1(v1, v2, r0->s1, 0); } @@ -670,12 +663,12 @@ copy1(Adr *v1, Adr *v2, Flow *r, int f) int t; Prog *p; - if(active[r->active]) { + if(r->active) { if(debug['P']) print("act set; return 1\n"); return 1; } - active[r->active] = 1; + r->active = 1; if(debug['P']) print("copy %D->%D f=%d\n", v1, v2, f); for(; r != nil; r = r->s1) { diff --git a/src/cmd/8g/peep.c b/src/cmd/8g/peep.c index a9155c935e..6e4d8176c1 100644 --- a/src/cmd/8g/peep.c +++ b/src/cmd/8g/peep.c @@ -91,8 +91,6 @@ peep(Prog *firstp) g = flowstart(firstp, sizeof(Flow)); if(g == nil) return; - for(r=g->start, t=0; r!=nil; r=r->link, t++) - r->active = t; // byte, word arithmetic elimination. elimshortmov(g); @@ -426,9 +424,6 @@ gotit: return 1; } -static uchar *active; -static int nactive; - /* * The idea is to remove redundant copies. * v1->v2 F=0 @@ -446,17 +441,15 @@ copyprop(Graph *g, Flow *r0) { Prog *p; Adr *v1, *v2; + Flow *r; p = r0->prog; v1 = &p->from; v2 = &p->to; if(copyas(v1, v2)) return 1; - if(nactive < g->num) { - nactive = g->num; - active = realloc(active, g->num); - } - memset(active, 0, g->num); + for(r=g->start; r!=nil; r=r->link) + r->active = 0; return copy1(v1, v2, r0->s1, 0); } @@ -466,12 +459,12 @@ copy1(Adr *v1, Adr *v2, Flow *r, int f) int t; Prog *p; - if(active[r->active]) { + if(r->active) { if(debug['P']) print("act set; return 1\n"); return 1; } - active[r->active] = 1; + r->active = 1; if(debug['P']) print("copy %D->%D f=%d\n", v1, v2, f); for(; r != nil; r = r->s1) {