diff options
| author | 2023-06-24 22:19:14 +0200 | |
|---|---|---|
| committer | 2023-06-24 22:19:14 +0200 | |
| commit | 02d7b9d8c67b12f2e105ee56399a1fc633bcbe0f (patch) | |
| tree | c7ed9c437f807740fc532cb229120d0d3155b80e /ir.c | |
| parent | 19bbdfa3c7ae05f4694ce5e434d9855c6f2c3682 (diff) | |
fix replcuses
Diffstat (limited to 'ir.c')
| -rw-r--r-- | ir.c | 33 |
1 files changed, 16 insertions, 17 deletions
@@ -376,30 +376,29 @@ insertphi(struct block *blk, enum irclass cls) void replcuses(union ref from, union ref to) { - struct use *use, *uend; - assert(from.t == RTMP); - uend = (use = instruse[from.i]) + instrnuse[from.i]; - for (; use < uend; ++use) { + for (int i = 0; i < instrnuse[from.i]; ++i) { + struct use use = instruse[from.i][i]; union ref *u; - int n, i; - if (use->u == from.i) continue; - if (use->u == USERJUMP) { - u = &use->blk->jmp.arg[0]; + int n, j; + if (use.u == from.i) continue; + if (use.u == USERJUMP) { + u = &use.blk->jmp.arg[0]; n = 2; - } else if (instrtab[use->u].op == Ophi) { - u = phitab.p[instrtab[use->u].l.i]; - n = use->blk->npred; + } else if (instrtab[use.u].op == Ophi) { + u = phitab.p[instrtab[use.u].l.i]; + n = use.blk->npred; } else { - u = &instrtab[use->u].l; + u = &instrtab[use.u].l; n = 2; } - for (i = 0; i < n; ++i) { - if (u[i].bits == from.bits) { - deluse(use->blk, use->u, u[i]); - u[i].bits = to.bits; - adduse(use->blk, use->u, u[i]); + for (j = 0; j < n; ++j) { + if (u[j].bits == from.bits) { + u[j].bits = to.bits; + adduse(use.blk, use.u, to); + deluse(use.blk, use.u, from); + --i; break; } } |