[all-commits] [llvm/llvm-project] 2e8149: [BFI] Simplify irreducible header discovery. NFC (...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jul 31 19:04:59 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e81492b8a770ebe927ca2bf0b609b80e0713b66
      https://github.com/llvm/llvm-project/commit/2e81492b8a770ebe927ca2bf0b609b80e0713b66
  Author: Fangrui Song <i at maskray.me>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
    M llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp

  Log Message:
  -----------
  [BFI] Simplify irreducible header discovery. NFC (#213213)

IrreducibleGraph is the explicit graph of a region -- a loop, or the
whole function -- that BFI searches for irreducible SCCs. It maintains
predecessor lists only so findIrreducibleHeaders can ask of each node
whether a predecessor lies outside its SCC (an entry), and whether a
non-entry in the same SCC reaches it via a backedge (an extra header).

Answer both from the successor lists instead; IrrNode then needs only a
successor vector. findIrreducibleHeaders is left partitioning the SCC
its sole caller is packaging, so fold it into createIrreducibleLoop.
Headers and members are sorted, so the changed iteration order does not
affect output.

Once BFI uses CycleInfo, a region's irreducible SCCs are its
non-reducible child cycles, which should let IrreducibleGraph go away
entirely. That removal has no predecessor lists to walk and
getResolvedNode has no inverse, so it must sweep successors regardless;
settling the formulation here leaves it changing only the graph.

Aided by Claude Opus 5



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