diff options
| author | 2025-11-02 19:26:01 +0100 | |
|---|---|---|
| committer | 2025-11-02 19:26:01 +0100 | |
| commit | fab6314ffcb547cbbf45ce16e390eba00e5bfa31 (patch) | |
| tree | 63bc430c4009122367e13ce52446b440c3d652e9 /ir/cfg.c | |
| parent | ca3dd9e031edf9c5c756e7bcee12a45eca368c62 (diff) | |
cfg: allow dead blocks with alloca pseudo instrs
Diffstat (limited to 'ir/cfg.c')
| -rw-r--r-- | ir/cfg.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -24,14 +24,19 @@ sortrpo(struct function *fn) fn->entry->id = 0; porec(&rpo, fn->entry); ndead = rpo - rpobuf; - for (struct block *blk = fn->entry->lprev, *next; ndead > 0; blk = next) { + for (struct block *blk = fn->entry->lprev, *next; blk != fn->entry; blk = next) { next = blk->lprev; if (!wasvisited(blk)) { + for (int i = 0; i < blk->ins.n; ++i) { + /* don't delete unreachable blocks with alloca pseudo-instrs */ + if (oisalloca(instrtab[blk->ins.p[i]].op)) + goto Next; + } for (int i = 0; i < blk->npred; ++i) assert(!wasvisited(blkpred(blk, i))); - blk->lnext = blk->lprev = NULL; freeblk(fn, blk); --ndead; + Next:; } } for (i = 1, ++rpo; rpo < rpoend; ++rpo, ++i) { |