aboutsummaryrefslogtreecommitdiffhomepage
path: root/ir/cfg.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-02-19 20:07:56 +0100
committerlemon <lsof@mailbox.org>2026-02-19 20:07:56 +0100
commit5ccb5432d0257fd5bdb92fcb22bd0fe58922498c (patch)
tree6b0df5ed455deeb22bbdd580948aa1822d4ed650 /ir/cfg.c
parent7c6d9ed9e30d673333464a4d69ce49596a4c844f (diff)
cfg: dominator computation should ignore blocks with no predecessors
These didn't show up atp before but with inlining, for example, a noreturn function, they could be introduced. And the pass ordering means they wouldn't have been cleaned up before filldom(). An unreachable block having no dominator makes sense too.
Diffstat (limited to 'ir/cfg.c')
-rw-r--r--ir/cfg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ir/cfg.c b/ir/cfg.c
index 24a0614..984b6a9 100644
--- a/ir/cfg.c
+++ b/ir/cfg.c
@@ -69,10 +69,10 @@ filldom(struct function *fn)
fn->entry->idom = fn->entry;
for (bool changed = 1; changed;) {
changed = 0;
- blk = fn->entry->lnext;
do {
int j;
struct block *new = NULL;
+ if (blk->npred == 0) continue;
for (j = 0; j < blk->npred; ++j)
if ((new = blkpred(blk, j))->id < blk->id) break;
assert(new);