[all-commits] [llvm/llvm-project] 571a1d: [LoopInfo] Store blocks using Euler tour represent...

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Jul 24 18:57:24 PDT 2026


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

  Changed paths:
    M bolt/include/bolt/Core/BinaryLoop.h
    M bolt/test/X86/loop-nest.test
    M llvm/include/llvm/Analysis/LoopInfo.h
    M llvm/include/llvm/CodeGen/MachineLoopInfo.h
    M llvm/include/llvm/Support/GenericLoopInfo.h
    M llvm/include/llvm/Support/GenericLoopInfoImpl.h
    M llvm/test/Transforms/LoopVectorize/early_exit_with_outer_loop.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-freeze.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
    M mlir/include/mlir/Analysis/CFGLoopInfo.h
    M mlir/lib/Analysis/CFGLoopInfo.cpp

  Log Message:
  -----------
  [LoopInfo] Store blocks using Euler tour representation (#211485)

Block list construction appends each block to all enclosing loops
(O(depth) per block), and each loop owns a separately allocated vector.

Switch to an Euler tour representation: one BlockLayout array per
LoopInfo holding the in-loop blocks in a loop-contiguous reverse
postorder, each loop's list a [begin, end) slice of it, subloop slices
nested inside their parent's. Headers remain first;
`SubLoops`/`TopLevelLoops` orders are unchanged. A few tests observe the
order and are updated. (Previously a loop's list was the function's
reverse postorder restricted to its members, so a subloop's blocks were
interleaved with the parent's own blocks at their RPO positions.)

Mutations first copy a borrowed slice into private storage from
LoopInfo's allocator. `contains(BlockT *)` remains map-based: a
materialized loop's slice is not a membership test. This copy is rare:
across default<O2> over dagcombiner and sqlite3, only 12--14% of loops
built by analyze() are ever mutated; the rest keep the borrowed slice.

AllocateLoop() no longer forwards constructor arguments; analyze() uses
allocateLoop(Header), removing the header-taking loop constructors.

Aided by Claude Fable 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