commit e91a7788e0c242d1891aeb1d9df5946027fb9f6d
parent 956154e06e9130e75cac30a18dddfa04bda347ba
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Fri, 26 Feb 2016 15:40:19 -0500
bug in liveout()
Because of the bsclr() call, liveout was not actually
making the union correctly. Instead of performing an
union, it now fully sets the bitset passed as parameter.
Diffstat:
2 files changed, 10 insertions(+), 24 deletions(-)
diff --git a/lisc/live.c b/lisc/live.c
@@ -6,7 +6,7 @@ liveon(BSet *v, Blk *b, Blk *s)
Phi *p;
uint a;
- bsunion(v, s->in);
+ bscopy(v, s->in);
for (p=s->phi; p; p=p->link) {
bsclr(v, p->to.val);
for (a=0; a<p->narg; a++)
@@ -14,19 +14,6 @@ liveon(BSet *v, Blk *b, Blk *s)
if (rtype(p->arg[a]) == RTmp)
bsset(v, p->arg[a].val);
}
- return;
-
- /*
- v = s->in;
- for (p=s->phi; p; p=p->link) {
- BCLR(v, p->to.val);
- for (a=0; a<p->narg; a++)
- if (p->blk[a] == b)
- if (rtype(p->arg[a]) == RTmp)
- BSET(v, p->arg[a].val);
- }
- return v;
- */
}
static int
@@ -102,15 +89,15 @@ Again:
b = f->rpo[n];
bscopy(u, b->out);
- if (b->s1)
- liveon(b->out, b, b->s1);
- if (b->s2)
- liveon(b->out, b, b->s2);
-
- if (bsequal(b->out, u))
- continue;
- else
- chg = 1;
+ if (b->s1) {
+ liveon(v, b, b->s1);
+ bsunion(b->out, v);
+ }
+ if (b->s2) {
+ liveon(v, b, b->s2);
+ bsunion(b->out, v);
+ }
+ chg |= !bsequal(b->out, u);
memset(phi, 0, f->ntmp * sizeof phi[0]);
memset(nlv, 0, sizeof nlv);
diff --git a/lisc/spill.c b/lisc/spill.c
@@ -397,7 +397,6 @@ spill(Fn *fn)
} else if (s1) {
liveon(v, b, s1);
if (s2) {
- bszero(u);
liveon(u, b, s2);
bscopy(w, u);
bsinter(w, v);