From 4be29d40305917d3c4bdb9e9c795ea68e415c748 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Sun, 21 Feb 2016 21:22:05 -0500 Subject: do not spill dead phis Regalloc will be able to handle these spurious phis, however, some other spurious dead instructions can be emitted. It would be better to get rid of them upfront; maybe by modifying isel, or by inserting a proper dce pass. An example of that undesirable behavior is exposed below. @l1 %foo =w ... @l2 %dead =w phi @l1 %foo, ... --- lisc/spill.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lisc/spill.c') diff --git a/lisc/spill.c b/lisc/spill.c index 06c748d..5875fc0 100644 --- a/lisc/spill.c +++ b/lisc/spill.c @@ -492,7 +492,8 @@ spill(Fn *fn) if (BGET(v, t)) { BCLR(v, t); store(p->to, tmp[t].slot); - } else + } else if (BGET(b->in, t)) + /* only if the phi is live */ p->to = slot(p->to.val); } b->in = v; -- cgit 1.4.1