summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-12 10:49:56 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-12 10:49:56 -0400
commit6e70be3f22f85b02cdc30ef506f289b2700ca986 (patch)
tree40d2a8dfe464b707982eb12853bb8002654292d1
parentb58fdfec9dfbbb870552e4b50d34e8cba4ffc288 (diff)
downloadroux-6e70be3f22f85b02cdc30ef506f289b2700ca986.tar.gz
simplify fillpreds() code
-rw-r--r--ssa.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ssa.c b/ssa.c
index 77c6258..7e03578 100644
--- a/ssa.c
+++ b/ssa.c
@@ -87,16 +87,11 @@ filluse(Fn *fn)
 static void
 addpred(Blk *bp, Blk *bc)
 {
-	uint i;
-
 	if (!bc->pred) {
 		bc->pred = alloc(bc->npred * sizeof bc->pred[0]);
-		for (i=0; i<bc->npred; i++)
-			bc->pred[i] = 0;
+		bc->visit = 0;
 	}
-	for (i=0; bc->pred[i]; i++)
-		;
-	bc->pred[i] = bp;
+	bc->pred[bc->visit++] = bp;
 }
 
 /* fill predecessors information in blocks