[all-commits] [llvm/llvm-project] 3f6af3: [CycleInfo] Store blocks using Euler tour represen...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jul 14 18:31:49 PDT 2026


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

  Changed paths:
    M llvm/include/llvm/ADT/GenericCycleImpl.h
    M llvm/include/llvm/ADT/GenericCycleInfo.h
    M llvm/test/Analysis/CycleInfo/basic.ll
    M llvm/test/Analysis/CycleInfo/unreachable-predecessor.ll
    M llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/branch-outside.ll
    M llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers-nested.ll
    M llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers.ll
    M llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/exit-divergence.ll
    M llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/reducible-headers.ll
    M llvm/test/CodeGen/X86/cycle-info.mir
    M llvm/test/Transforms/FixIrreducible/callbr.ll

  Log Message:
  -----------
  [CycleInfo] Store blocks using Euler tour representation (#208614)

Each GenericCycle owned a `SetVector<BlockT*>` of its blocks (its own
plus every nested cycle's), so a block nested D cycles deep is stored D
times.

Instead, store every cycle's blocks in one GenericCycleInfo::BlockLayout
array laid out as an Euler tour of the cycle forest: each cycle owns a
contiguous range [IdxBegin, IdxEnd) nested inside its parent's.

run() builds the cycle tree and the block-to-innermost-cycle map as
before, then lays the array out in `layoutBlocks`. Its DFS also moves
from a single worklist that eagerly pushed every successor (so the stack
grew with the fan-out along the current path) to a stack of (block,
successor cursor) frames bounded by the DFS depth, with each block
pushed once; successors are still visited in the same order (hence the
weird `std::reverse_iterator`), so the cycles found are unchanged.

Block iteration order within a cycle changes, so cycle-print order in
some
CycleInfo/UniformityAnalysis/FixIrreducible tests shifts (block sets are
unchanged).

Aided by Claude Opus 4.8



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