From 0679df0b5620c032f4e2a17ab5faa94ff1ea3ce9 Mon Sep 17 00:00:00 2001
From: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Sun, 1 Nov 2015 13:55:06 -0500
Subject: [PATCH] break Tmp.phi chains at phi nodes

This makes sure the Tmp.phi "chain" is at most
two elements long.  Something smarted could be
possible, but union-find with path compression
is still not exactly what I want.
---
 lisc/parse.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisc/parse.c b/lisc/parse.c
index 9e047dc..54031e7 100644
--- a/lisc/parse.c
+++ b/lisc/parse.c
@@ -547,7 +547,9 @@ DoOp:
 			arg[i] = parseref();
 			if (req(arg[i], R))
 				err("invalid instruction argument");
-			if (op == -1 && rtype(arg[i]) == RTmp)
+			if (op == -1)
+			if (rtype(arg[i]) == RTmp)
+			if (!tmp[arg[i].val].phi)
 				tmp[arg[i].val].phi = r.val;
 			i++;
 			t = peek();
@@ -570,6 +572,7 @@ DoOp:
 		curi++;
 		return PIns;
 	} else {
+		tmp[r.val].phi = r.val;
 		phi = alloc(sizeof *phi);
 		phi->to = r;
 		phi->wide = w;