summary refs log tree commit diff
path: root/lisc/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-08-15 20:49:20 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2015-09-15 23:01:31 -0400
commitbccfc34ca3f58a2e6706fa37bc0729a56f35bc1f (patch)
tree332e3a44e0930b0825f8f9eec1eda578b59ddb47 /lisc/isel.c
parentabbe53285f032e4804d86baff59ac5ac49795df7 (diff)
downloadroux-bccfc34ca3f58a2e6706fa37bc0729a56f35bc1f.tar.gz
make sure eflags-writing do not disappear
This is a hack implementation, ideally I would like
something cleaner.  The problem is that regalloc thinks
an instruction is dead code because it's not aware that
it writes to eflags.
Diffstat (limited to 'lisc/isel.c')
-rw-r--r--lisc/isel.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisc/isel.c b/lisc/isel.c
index 6f2147f..97a0124 100644
--- a/lisc/isel.c
+++ b/lisc/isel.c
@@ -318,8 +318,11 @@ seljmp(Blk *b, Fn *fn)
 				selcmp(fi->arg, fn);
 				*fi = (Ins){ONop, R, {R, R}};
 			}
-		} else
+		} else {
+			if (fn->tmp[r.val].nuse == 1)
+				emit(OCopy, R, r, R);
 			b->jmp.type = JXJc + Cne;
+		}
 	} else {
 		selcmp((Ref[2]){r, CON_Z}, fn);
 		b->jmp.type = JXJc + Cne;