summary refs log tree commit diff
path: root/copy.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-19 11:07:07 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-19 11:07:54 -0400
commit43967b6306aa18903b3ba2b00e701facaf306840 (patch)
tree146330b3da69d9a27f83fe1db93dd09f2c0a6764 /copy.c
parent20c9ec62ffde331fad41c5f05cc05a20b7aa08fa (diff)
downloadroux-43967b6306aa18903b3ba2b00e701facaf306840.tar.gz
use assert for ssa invariants in fold/copy
Diffstat (limited to 'copy.c')
-rw-r--r--copy.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/copy.c b/copy.c
index 0ed62b0..71720f9 100644
--- a/copy.c
+++ b/copy.c
@@ -65,11 +65,9 @@ visitins(Ins *i, Ref *cp, RList **w)
 }
 
 static void
-subst(Ref *r, Ref *cp, Fn *fn)
+subst(Ref *r, Ref *cp)
 {
-	if (rtype(*r) == RTmp && req(copyof(*r, cp), R))
-		err("temporary %%%s is ill-defined",
-			fn->tmp[r->val].name);
+	assert((rtype(*r) != RTmp || !req(copyof(*r, cp), R)) && "ssa invariant broken");
 	*r = copyof(*r, cp);
 }
 
@@ -121,7 +119,7 @@ copy(Fn *fn)
 				continue;
 			}
 			for (a=0; a<p->narg; a++)
-				subst(&p->arg[a], cp, fn);
+				subst(&p->arg[a], cp);
 			pp=&p->link;
 		}
 		for (i=b->ins; i-b->ins < b->nins; i++) {
@@ -131,9 +129,9 @@ copy(Fn *fn)
 				continue;
 			}
 			for (a=0; a<2; a++)
-				subst(&i->arg[a], cp, fn);
+				subst(&i->arg[a], cp);
 		}
-		subst(&b->jmp.arg, cp, fn);
+		subst(&b->jmp.arg, cp);
 	}
 	if (debug['C']) {
 		fprintf(stderr, "\n> Copy information:");