qbe

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

commit 71e6fa0b302e38232199f53214d06d7001c64caa
parent a8fc6960525fd77a5a458e878809907939fb5f3e
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Sat,  9 Apr 2016 14:31:23 -0400

oops, forgot to patch phi arguments

Diffstat:
Mfold.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fold.c b/fold.c @@ -168,6 +168,7 @@ fold(Fn *fn) Phi *p, **pp; Ins *i; int n, l, d; + uint a; val = emalloc(fn->ntmp * sizeof val[0]); edge = emalloc(fn->nblk * sizeof edge[0]); @@ -261,8 +262,13 @@ fold(Fn *fn) for (pp=&b->phi; (p=*pp);) if (val[p->to.val] != Bot) *pp = p->link; - else + else { + for (a=0; a<p->narg; a++) + if (rtype(p->arg[a]) == RTmp) + if ((l=val[p->arg[a].val]) != Bot) + p->arg[a] = CON(l); pp = &p->link; + } for (i=b->ins; i-b->ins < b->nins; i++) { if (rtype(i->to) == RTmp) if (val[i->to.val] != Bot) {