summary refs log tree commit diff
path: root/rega.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-01 10:51:06 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-01 10:51:06 -0400
commitd14e885325071bcac823053c1bcc4b4ed0d35145 (patch)
tree8dab3e1fbfbaf3e7903411177a931aaa71e79072 /rega.c
parente7825e70d532d16f1598eaa598342af373716418 (diff)
downloadroux-d14e885325071bcac823053c1bcc4b4ed0d35145.tar.gz
cheap massive performance gain on brainfuck
Diffstat (limited to 'rega.c')
-rw-r--r--rega.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/rega.c b/rega.c
index 0f1ad17..23f078c 100644
--- a/rega.c
+++ b/rega.c
@@ -426,7 +426,7 @@ doblk(Blk *b, RMap *cur)
 void
 rega(Fn *fn)
 {
-	int j, n, t, r, r1, x, rl[Tmp0];
+	int j, t, n, r, r1, x, rl[Tmp0];
 	Blk *b, *b1, *s, ***ps, *blist;
 	RMap *end, *beg, cur, old;
 	Ins *i;
@@ -463,15 +463,10 @@ rega(Fn *fn)
 		cur.n = 0;
 		bszero(cur.b);
 		for (x=0; x<2; x++)
-			for (t=Tmp0; t<fn->ntmp; t++) {
-				assert(bshas(b->out, t) ||
-					!bshas(cur.b, t));
-				if (bshas(b->out, t))
-				if (!bshas(cur.b, t))
+			for (t=Tmp0; bsiter(b->out, &t); t++)
 				if (x || (r=*hint(t)) != -1)
 				if (x || !bshas(cur.b, r))
 					ralloc(&cur, t);
-			}
 		rcopy(&end[n], &cur);
 		doblk(b, &cur);
 		bscopy(b->in, cur.b);