commit 436d0fc07e4551dd4265cfed0b0bc459c71ed8ce
parent 425a2ed09c08222e1254d93dba24c7a50e7a08b9
Author: Quentin Carbonneaux <quentin@c9x.me>
Date: Tue, 16 May 2017 11:44:52 -0400
change the computation of spill costs for phis
I now take the view that a phi is "used" at the
end of all the predecessors. (Think that copies
are made to phis at the end of all predecessors.)
Diffstat:
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/spill.c b/spill.c
@@ -68,13 +68,11 @@ fillcost(Fn *fn)
}
for (b=fn->start; b; b=b->link) {
for (p=b->phi; p; p=p->link) {
- /* todo, the cost computation
- * for p->to is not great... */
+ t = &fn->tmp[p->to.val];
tmpuse(p->to, 0, 0, fn);
for (a=0; a<p->narg; a++) {
n = p->blk[a]->loop;
- assert(b->npred==p->narg && "wrong cfg");
- n /= b->npred;
+ t->cost += n;
tmpuse(p->arg[a], 1, n, fn);
}
}