summary refs log tree commit diff
path: root/lisc/ssa.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-11-16 17:54:16 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-11-16 17:54:16 -0500
commitc744281317a0c7c011fc3c88a2336cdff6382935 (patch)
tree344b9df922b35d9f3a439def40916d8b04addf5c /lisc/ssa.c
parentb8c76457464714908bef43fd992a56ca94091eba (diff)
downloadroux-c744281317a0c7c011fc3c88a2336cdff6382935.tar.gz
uniformize looping on instructions
I am actually not sure if "i-b->ins < b->nins" is the best way,
maybe the comparison with the last instruction is a little more
efficient...  At least it is uniform now.
Diffstat (limited to 'lisc/ssa.c')
-rw-r--r--lisc/ssa.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisc/ssa.c b/lisc/ssa.c
index 7a7f55e..ac90b6e 100644
--- a/lisc/ssa.c
+++ b/lisc/ssa.c
@@ -63,7 +63,7 @@ filluse(Fn *fn)
 						tmp[t].phi = p->to.val;
 				}
 		}
-		for (i=b->ins; i!=&b->ins[b->nins]; i++) {
+		for (i=b->ins; i-b->ins < b->nins; i++) {
 			if (!req(i->to, R)) {
 				assert(rtype(i->to) == RTmp);
 				tmp[i->to.val].ndef++;
@@ -303,7 +303,7 @@ phiins(Fn *fn)
 		for (b=fn->start; b; b=b->link) {
 			b->visit = 0;
 			r = R;
-			for (i=b->ins; i!=&b->ins[b->nins]; i++) {
+			for (i=b->ins; i-b->ins < b->nins; i++) {
 				if (!req(r, R)) {
 					if (req(i->arg[0], TMP(t)))
 						i->arg[0] = r;
@@ -438,7 +438,7 @@ renblk(Blk *b, Name **stk, Fn *fn)
 
 	for (p=b->phi; p; p=p->link)
 		rendef(&p->to, b, stk, fn);
-	for (i=b->ins; i!=&b->ins[b->nins]; i++) {
+	for (i=b->ins; i-b->ins < b->nins; i++) {
 		for (m=0; m<2; m++) {
 			t = i->arg[m].val;
 			if (rtype(i->arg[m]) == RTmp)