diff options
-rw-r--r-- | lisc/isel.c | 12 |
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; |