summary refs log tree commit diff
path: root/lisc
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-26 15:40:19 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-02-26 15:40:19 -0500
commite91a7788e0c242d1891aeb1d9df5946027fb9f6d (patch)
tree590d3158c7f8d7101f744b40dc052da8c7bc03e0 /lisc
parent956154e06e9130e75cac30a18dddfa04bda347ba (diff)
downloadroux-e91a7788e0c242d1891aeb1d9df5946027fb9f6d.tar.gz
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 (limited to 'lisc')
-rw-r--r--lisc/live.c33
-rw-r--r--lisc/spill.c1
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; 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
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);