summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-09 14:31:23 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-09 14:31:23 -0400
commit71e6fa0b302e38232199f53214d06d7001c64caa (patch)
tree39b6a3f66eba1e4e2823897e9d0f979715e868e1
parenta8fc6960525fd77a5a458e878809907939fb5f3e (diff)
downloadroux-71e6fa0b302e38232199f53214d06d7001c64caa.tar.gz
oops, forgot to patch phi arguments
-rw-r--r--fold.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fold.c b/fold.c
index 2962991..e5c92c3 100644
--- a/fold.c
+++ b/fold.c
@@ -168,6 +168,7 @@ fold(Fn *fn)
 	Phi *p, **pp;
 	Ins *i;
 	int n, l, d;
+	uint a;
 
 	val = emalloc(fn->ntmp * sizeof val[0]);
 	edge = emalloc(fn->nblk * sizeof edge[0]);
@@ -261,8 +262,13 @@ fold(Fn *fn)
 		for (pp=&b->phi; (p=*pp);)
 			if (val[p->to.val] != Bot)
 				*pp = p->link;
-			else
+			else {
+				for (a=0; a<p->narg; a++)
+					if (rtype(p->arg[a]) == RTmp)
+					if ((l=val[p->arg[a].val]) != Bot)
+						p->arg[a] = CON(l);
 				pp = &p->link;
+			}
 		for (i=b->ins; i-b->ins < b->nins; i++) {
 			if (rtype(i->to) == RTmp)
 			if (val[i->to.val] != Bot) {