From e91a7788e0c242d1891aeb1d9df5946027fb9f6d Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Fri, 26 Feb 2016 15:40:19 -0500 Subject: 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. --- lisc/live.c | 33 ++++++++++----------------------- lisc/spill.c | 1 - 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/lisc/live.c b/lisc/live.c index dceb7e2..06bc56c 100644 --- 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; anarg; 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; anarg; 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 index 5984372..3a7bc35 100644 --- 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); -- cgit 1.4.1