From 6cba2db94922c6542d0de7e4f4d4a2323a6d9981 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 16 Mar 2016 10:57:41 -0400 Subject: document oddity in seljmp() --- lisc/isel.c | 12 ++++++++---- 1 file 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; -- cgit 1.4.1