From bb2541693e0a3a621202b75f08a5d5ffa28a13a7 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 22 Jul 2015 03:50:52 -0400 Subject: correct phi usage accounting --- lisc/spill.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lisc') diff --git a/lisc/spill.c b/lisc/spill.c index 6c72b67..898932e 100644 --- a/lisc/spill.c +++ b/lisc/spill.c @@ -6,7 +6,7 @@ loopmark(Blk **rpo, int head, Blk *b) { uint p; - if (b->id <= head || b->visit == head) + if (b->id < head || b->visit == head) return; b->visit = head; b->loop *= 10; @@ -66,11 +66,13 @@ fillcost(Fn *fn) for (p=b->phi; p; p=p->link) { /* zero cost for temporaries used * in phi instructions */ - assert(rtype(p->to) == RSym); - assert(fn->sym[p->to.val].type == STmp); symuse(p->to, 0, 0, fn); - for (a=0; anarg; a++) - symuse(p->arg[a], 1, 0, fn); + for (a=0; anarg; a++) { + n = p->blk[a]->loop; + assert(b->npred && "invalid cfg"); + n /= b->npred; + symuse(p->arg[a], 1, n, fn); + } } n = b->loop; for (i=b->ins; i-b->ins < b->nins; i++) { -- cgit 1.4.1