qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit bb2541693e0a3a621202b75f08a5d5ffa28a13a7
parent 6e8e6d336827f6a46258c43018b33420a30b58d2
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Wed, 22 Jul 2015 03:50:52 -0400

correct phi usage accounting

Diffstat:
Mlisc/spill.c | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git 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; a<p->narg; a++) - symuse(p->arg[a], 1, 0, fn); + for (a=0; a<p->narg; 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++) {