summary refs log tree commit diff
path: root/lisc/rega.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-07 19:52:50 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:30 -0400
commit75eb0c32248ddad6c8c26637c58d9a50aa619a2d (patch)
tree1244eb9ba2e5108ddecf784885ac54f586fefc56 /lisc/rega.c
parent23846dd534123b50fe1c989017c39b225bf152bd (diff)
downloadroux-75eb0c32248ddad6c8c26637c58d9a50aa619a2d.tar.gz
simplify frequent pred detection in rega
Diffstat (limited to 'lisc/rega.c')
-rw-r--r--lisc/rega.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/lisc/rega.c b/lisc/rega.c
index 6658075..98fe711 100644
--- a/lisc/rega.c
+++ b/lisc/rega.c
@@ -293,19 +293,16 @@ rega(Fn *fn)
 		cur.n = 0;
 		cur.bt = (Bits){{0}};
 		cur.br = (Bits){{0}};
-		b1 = 0;
-		if (b->s1 && b->s1->id > n) {
-			if (b->s1->loop > b->loop)
-				b1 = b->s1;
-			if (b->s2 && b->s2->id > n)
-			if (b->s2->loop > b1->loop)
-				b1 = b->s2;
-		}
+		b1 = b;
+		if (b->s1 && b1->loop < b->s1->loop)
+			b1 = b->s1;
+		if (b->s2 && b1->loop < b->s2->loop)
+			b1 = b->s1;
 		/* try to reuse the register
 		 * assignment of the most frequent
 		 * successor
 		 */
-		if (b1)
+		if (b1 != b)
 			for (t=0; t<fn->ntmp; t++)
 				if (BGET(b->out, t))
 				if ((r = rfind(&beg[b1->id], t)) != -1)