summary refs log tree commit diff
path: root/ssa.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-13 11:41:26 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-13 12:39:57 -0400
commit491c55e6e0295904c8c5f996503b4e8b9e2e180c (patch)
treeb61a2d311046ea655419b3fc87168109e077f827 /ssa.c
parent8992106928756d47697ea26f88b7b5eceacf3845 (diff)
downloadroux-491c55e6e0295904c8c5f996503b4e8b9e2e180c.tar.gz
handle odd jumps in blkdel() an renblk()
Diffstat (limited to 'ssa.c')
-rw-r--r--ssa.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ssa.c b/ssa.c
index 298f0ae..c35fd7e 100644
--- a/ssa.c
+++ b/ssa.c
@@ -154,15 +154,14 @@ fillrpo(Fn *f)
 	n = 1 + rporec(f->start, f->nblk-1);
 	f->nblk -= n;
 	f->rpo = alloc(f->nblk * sizeof f->rpo[0]);
-	for (p=&f->start; *p;) {
-		b = *p;
+	for (p=&f->start; (b=*p);) {
 		if (b->id == -1) {
 			blkdel(b);
 			*p = b->link;
 		} else {
 			b->id -= n;
 			f->rpo[b->id] = b;
-			p=&(*p)->link;
+			p = &b->link;
 		}
 	}
 }
@@ -453,7 +452,7 @@ renblk(Blk *b, Name **stk, Fn *fn)
 	if (fn->tmp[t].visit)
 		b->jmp.arg = getstk(t, b, stk);
 	succ[0] = b->s1;
-	succ[1] = b->s2;
+	succ[1] = b->s2 == b->s1 ? 0 : b->s2;
 	succ[2] = 0;
 	for (ps=succ; (s=*ps); ps++)
 		for (p=s->phi; p; p=p->link) {