summary refs log tree commit diff
path: root/lisc/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-16 10:57:41 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-16 10:59:26 -0400
commit6cba2db94922c6542d0de7e4f4d4a2323a6d9981 (patch)
tree6d60ea678a3b515c5b840615205e8745a7b6c850 /lisc/isel.c
parent7e1db6cc659dc701391639a40790645940a53879 (diff)
downloadroux-6cba2db94922c6542d0de7e4f4d4a2323a6d9981.tar.gz
document oddity in seljmp()
Diffstat (limited to 'lisc/isel.c')
-rw-r--r--lisc/isel.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index d61709b..6dfc06f 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -397,10 +397,14 @@ seljmp(Blk *b, Fn *fn)
 			}
 			return;
 		}
-		if (fn->tmp[r.val].nuse > 1) {
-			b->jmp.type = JXJc + ICne;
-			return;
-		}
+		/* since flags are not tracked in liveness,
+		 * the result of the flag-setting instruction
+		 * has to be marked as live
+		 */
+		if (fn->tmp[r.val].nuse == 1)
+			emit(OCopy, Kw, R, r, R);
+		b->jmp.type = JXJc + ICne;
+		return;
 	}
 	selcmp((Ref[2]){r, CON_Z}, Kw, fn); /* todo, add long branch if non-zero */
 	b->jmp.type = JXJc + ICne;