summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-19 11:04:28 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-19 11:04:48 -0400
commit20c9ec62ffde331fad41c5f05cc05a20b7aa08fa (patch)
treeabe4a79e678415e7dd508c89fab156c24f75b85c
parentf5c4f9b76fe72d59b71879a36c9fca99e17f2824 (diff)
downloadroux-20c9ec62ffde331fad41c5f05cc05a20b7aa08fa.tar.gz
check for trivial undefined uses in ssacheck
-rw-r--r--ssa.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ssa.c b/ssa.c
index e5f0f44..a2efb28 100644
--- a/ssa.c
+++ b/ssa.c
@@ -536,10 +536,15 @@ ssacheck(Fn *fn)
 	Blk *b, *bu;
 	Ref r;
 
-	for (t=&fn->tmp[Tmp0]; t-fn->tmp < fn->ntmp; t++)
+	for (t=&fn->tmp[Tmp0]; t-fn->tmp < fn->ntmp; t++) {
 		if (t->ndef > 1)
 			err("ssa temporary %%%s defined more than once",
 				t->name);
+		if (t->nuse > 0 && t->ndef == 0) {
+			bu = fn->rpo[t->use[0].bid];
+			goto Err;
+		}
+	}
 	for (b=fn->start; b; b=b->link) {
 		for (p=b->phi; p; p=p->link) {
 			r = p->to;