mirror of
git://c9x.me/qbe.git
synced 2026-05-26 15:34:41 +00:00
recognize more phis as copies
Not only phi(%a, %a, ...) is a copy but any argument can also be a self reference.
This commit is contained in:
parent
1366e70856
commit
ade9f31efb
16
copy.c
16
copy.c
@ -388,14 +388,20 @@ phicopyref(Fn *fn, Blk *b, Phi *p)
|
|||||||
{
|
{
|
||||||
Blk *d, **s;
|
Blk *d, **s;
|
||||||
Phi *p1;
|
Phi *p1;
|
||||||
|
Ref r;
|
||||||
uint n, c;
|
uint n, c;
|
||||||
|
|
||||||
/* identical args */
|
/* identical args */
|
||||||
for (n=0; n<p->narg-1; n++)
|
r = R;
|
||||||
if (!req(p->arg[n], p->arg[n+1]))
|
for (n=0; n<p->narg; n++)
|
||||||
break;
|
if (!req(p->arg[n], p->to)) {
|
||||||
if (n == p->narg-1)
|
if (req(r, R))
|
||||||
return p->arg[n];
|
r = p->arg[n];
|
||||||
|
else if (!req(p->arg[n], r))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (n == p->narg)
|
||||||
|
return r;
|
||||||
|
|
||||||
/* same as a previous phi */
|
/* same as a previous phi */
|
||||||
for (p1=b->phi; p1!=p; p1=p1->link) {
|
for (p1=b->phi; p1!=p; p1=p1->link) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user