[all-commits] [llvm/llvm-project] 3b8ee8: [MustExecute] Use the loop predecessor instead of ...

Timur Baidusenov via All-commits all-commits at lists.llvm.org
Wed Sep 16 00:26:01 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b8ee89006f5a228fce75528f8dd80b4229abcc1
      https://github.com/llvm/llvm-project/commit/3b8ee89006f5a228fce75528f8dd80b4229abcc1
  Author: Timur Baidusenov <timurbaidusenov at gmail.com>
  Date:   2026-09-16 (Wed, 16 Sep 2026)

  Changed paths:
    M llvm/lib/Analysis/MustExecute.cpp
    A llvm/test/Analysis/MustExecute/no-preheader.ll

  Log Message:
  -----------
  [MustExecute] Use the loop predecessor instead of the preheader (#222096)

CanProveNotTakenFirstIteration() gets the IV start value via
LHS->getIncomingValueForBlock(CurLoop->getLoopPreheader()). If the loop
is not in simplified form, getLoopPreheader() returns null and the
lookup asserts. This is reachable from print<must-execute> on IR that is
not in LoopSimplify form (see the reproducer in #166488).

Fixed: use getLoopPredecessor() instead: it returns the unique
out-of-loop predecessor of the header even when it is not a dedicated
preheader, consequently the start value is still known. If there is no
such predecessor, bail out.

Fixes #166488.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list