From 5ccb5432d0257fd5bdb92fcb22bd0fe58922498c Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 19 Feb 2026 20:07:56 +0100 Subject: 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. --- ir/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ir') 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); -- cgit v1.2.3