diff options
| author | Quentin Carbonneaux <[email protected]> | 2026-01-13 18:27:50 +0100 |
|---|---|---|
| committer | Quentin Carbonneaux <[email protected]> | 2026-01-13 18:27:50 +0100 |
| commit | afd5d2e518e23231604a1cac37b70695e10a63fa (patch) | |
| tree | ce1c30a3b8dd1931e5e9b115fbf44852357c6c34 | |
| parent | e8365dd0a2cb3050b62e9cb263e1a9a09481d76f (diff) | |
drop dead preds in fixphisdev
It is possible that GVN removes
some dead blocks, this could lead
to odd - but probably harmless -
phi args appearing in the IL.
This patch cleans things up during
fillcfg().
| -rw-r--r-- | cfg.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -16,19 +16,22 @@ newblk() static void fixphis(Fn *f) { - Blk *b; + Blk *b, *bp; Phi *p; uint n, n0; for (b=f->start; b; b=b->link) { assert(b->id < f->nblk); for (p=b->phi; p; p=p->link) { - for (n=n0=0; n<p->narg; n++) - if (p->blk[n]->id != -1u) { - p->blk[n0] = p->blk[n]; + for (n=n0=0; n<p->narg; n++) { + bp = p->blk[n]; + if (bp->id != -1u) + if (bp->s1 == b || bp->s2 == b) { + p->blk[n0] = bp; p->arg[n0] = p->arg[n]; n0++; } + } assert(n0 > 0); p->narg = n0; } |
