[llvm] [CycleInfo] Store blocks using Euler tour representation (PR #208614)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 21:06:55 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Fangrui Song (MaskRay)

<details>
<summary>Changes</summary>

Each GenericCycle owned a `SetVector<BlockT*>` of its blocks (its own plus every
nested cycle's), so a block nested D cycles deep was stored D times and each
cycle carried a hash set for contains().

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 [BlocksBegin, BlocksEnd) 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 one pass (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


---

Patch is 26.87 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/208614.diff


11 Files Affected:

- (modified) llvm/include/llvm/ADT/GenericCycleImpl.h (+125-63) 
- (modified) llvm/include/llvm/ADT/GenericCycleInfo.h (+53-28) 
- (modified) llvm/test/Analysis/CycleInfo/basic.ll (+1-1) 
- (modified) llvm/test/Analysis/CycleInfo/unreachable-predecessor.ll (+1-1) 
- (modified) llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/branch-outside.ll (+1-1) 
- (modified) llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers-nested.ll (+2-2) 
- (modified) llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers.ll (+1-1) 
- (modified) llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/exit-divergence.ll (+1-1) 
- (modified) llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/reducible-headers.ll (+3-3) 
- (modified) llvm/test/CodeGen/X86/cycle-info.mir (+3-3) 
- (modified) llvm/test/Transforms/FixIrreducible/callbr.ll (+6-6) 


``````````diff
diff --git a/llvm/include/llvm/ADT/GenericCycleImpl.h b/llvm/include/llvm/ADT/GenericCycleImpl.h
index 0d868857b14d9..01e452f37bfb5 100644
--- a/llvm/include/llvm/ADT/GenericCycleImpl.h
+++ b/llvm/include/llvm/ADT/GenericCycleImpl.h
@@ -27,6 +27,7 @@
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/GenericCycleInfo.h"
 #include "llvm/ADT/StringExtras.h"
+#include <iterator>
 
 #define DEBUG_TYPE "generic-cycle-impl"
 
@@ -34,14 +35,23 @@ namespace llvm {
 
 template <typename ContextT>
 bool GenericCycle<ContextT>::contains(const GenericCycle *C) const {
-  if (!C)
-    return false;
-
-  if (Depth > C->Depth)
-    return false;
-  while (Depth < C->Depth)
-    C = C->ParentCycle;
-  return this == C;
+  // Containment check using the Euler tour representation.
+  return C && IdxBegin <= C->IdxBegin && C->IdxEnd <= IdxEnd;
+}
+
+template <typename ContextT>
+bool GenericCycle<ContextT>::contains(const BlockT *Block) const {
+  return contains(CI->getCycle(Block));
+}
+
+template <typename ContextT>
+auto GenericCycle<ContextT>::block_begin() const -> const_block_iterator {
+  return CI->BlockLayout.begin() + IdxBegin;
+}
+
+template <typename ContextT>
+auto GenericCycle<ContextT>::block_end() const -> const_block_iterator {
+  return CI->BlockLayout.begin() + IdxEnd;
 }
 
 template <typename ContextT>
@@ -126,7 +136,7 @@ auto GenericCycle<ContextT>::getCyclePredecessor() const -> BlockT * {
 /// \brief Verify that this is actually a well-formed cycle in the CFG.
 template <typename ContextT> void GenericCycle<ContextT>::verifyCycle() const {
 #ifndef NDEBUG
-  assert(!Blocks.empty() && "Cycle cannot be empty.");
+  assert(getNumBlocks() != 0 && "Cycle cannot be empty.");
   DenseSet<BlockT *> Blocks;
   for (BlockT *BB : blocks()) {
     assert(Blocks.insert(BB).second); // duplicates in block list?
@@ -305,7 +315,8 @@ void GenericCycleInfo<ContextT>::moveTopLevelCycleToNewParent(CycleT *NewParent,
   for (CycleT *Cycle : depth_first(Child))
     Cycle->TopLevelCycle = NewParent;
 
-  NewParent->Blocks.insert_range(Child->blocks());
+  // Blocks are not stored per cycle during construction; the shared layout is
+  // built once at the end of run(), so only the tree links change here.
   NewParent->clearCache();
   Child->clearCache();
 }
@@ -333,20 +344,66 @@ void GenericCycleInfo<ContextT>::addBlockToCycle(BlockT *Block, CycleT *Cycle) {
   if (Number >= BlockMap.size())
     BlockMap.resize(GraphTraits<FunctionT *>::getMaxNumber(Block->getParent()));
 
-  // FixMe: Appending NewBlock is fine as a set of blocks in a cycle. When
-  // printing, cycle NewBlock is at the end of list but it should be in the
-  // middle to represent actual traversal of a cycle.
-  Cycle->appendBlock(Block);
+  // Insert Block at Pos (end of Cycle's slice) and shift every later cycle's
+  // range right, keyed on IdxBegin so a nested cycle sharing end == Pos is
+  // left alone; Cycle and its ancestors then grow to contain it, below.
+  // FixMe: appended at the slice end, not the traversal-order middle.
+  unsigned Pos = Cycle->IdxEnd;
+  BlockLayout.insert(BlockLayout.begin() + Pos, Block);
+  for (CycleT *TLC : toplevel_cycles())
+    for (CycleT *C : depth_first(TLC))
+      if (C->IdxBegin >= Pos) {
+        ++C->IdxBegin;
+        ++C->IdxEnd;
+      }
   addToBlockMap(Block, Cycle);
+  // Cycle and its ancestors gain the new block: extend each one's slice and
+  // invalidate its exit-block cache in a single walk up the tree.
+  for (CycleT *C = Cycle; C; C = C->getParentCycle()) {
+    ++C->IdxEnd;
+    C->clearCache();
+  }
+}
+
+template <typename ContextT>
+void GenericCycleInfo<ContextT>::layoutBlocks(ArrayRef<BlockT *> Order) {
+  if (TopLevelCycles.empty())
+    return;
 
-  CycleT *ParentCycle = Cycle->getParentCycle();
-  while (ParentCycle) {
-    Cycle = ParentCycle;
-    Cycle->appendBlock(Block);
-    ParentCycle = Cycle->getParentCycle();
+  // Walk the cycle forest as an Euler tour. On entry, a cycle's IdxEnd still
+  // holds its own-block count (accumulated during run()); reserve that many
+  // slots for its own region [Cursor, Cursor + count). Its children take the
+  // following slots, so on leaving, Cursor is the cycle's real range end, which
+  // overwrites the now-consumed count in IdxEnd.
+  struct Frame {
+    CycleT *C;
+    typename CycleT::const_child_iterator ChildCur, ChildEnd;
+  };
+  SmallVector<Frame, 8> Stack;
+  unsigned Cursor = 0;
+  auto enter = [&](CycleT *C) {
+    Cursor += C->IdxEnd; // IdxEnd currently holds C's own-block count.
+    C->IdxBegin = Cursor;
+    Stack.push_back({C, C->child_begin(), C->child_end()});
+  };
+  for (CycleT *TLC : toplevel_cycles()) {
+    enter(TLC);
+    while (!Stack.empty()) {
+      Frame &F = Stack.back();
+      if (F.ChildCur != F.ChildEnd) {
+        enter(*F.ChildCur++);
+      } else {
+        F.C->IdxEnd = Cursor;
+        Stack.pop_back();
+      }
+    }
   }
 
-  Cycle->clearCache();
+  // Place every block into its innermost cycle's own region.
+  BlockLayout.resize_for_overwrite(Cursor);
+  for (BlockT *B : llvm::reverse(Order))
+    if (CycleT *C = getCycle(B))
+      BlockLayout[--C->IdxBegin] = B;
 }
 
 /// \brief Main function of the cycle info computations.
@@ -377,9 +434,13 @@ void GenericCycleInfoCompute<ContextT>::run(FunctionT *F) {
     LLVM_DEBUG(errs() << "Found cycle for header: "
                       << Info.Context.print(HeaderCandidate) << "\n");
     std::unique_ptr<CycleT> NewCycle = std::make_unique<CycleT>();
+    NewCycle->CI = &Info;
     NewCycle->appendEntry(HeaderCandidate);
-    NewCycle->appendBlock(HeaderCandidate);
     Info.addToBlockMap(HeaderCandidate, NewCycle.get());
+    // The header is this cycle's first own block. Until layoutBlocks runs,
+    // IdxEnd accumulates this cycle's own-block count (see the IdxBegin/
+    // IdxEnd doc comment), so layoutBlocks needs no separate counting pass.
+    ++NewCycle->IdxEnd;
 
     // Helper function to process (non-back-edge) predecessors of a discovered
     // block and either add them to the worklist or recognize that the given
@@ -436,8 +497,7 @@ void GenericCycleInfoCompute<ContextT>::run(FunctionT *F) {
         }
       } else {
         Info.addToBlockMap(Block, NewCycle.get());
-        assert(!is_contained(NewCycle->Blocks, Block));
-        NewCycle->Blocks.insert(Block);
+        ++NewCycle->IdxEnd; // Block's innermost cycle is NewCycle.
         ProcessPredecessors(Block);
       }
     } while (!Worklist.empty());
@@ -453,6 +513,10 @@ void GenericCycleInfoCompute<ContextT>::run(FunctionT *F) {
     TLC->ParentCycle = nullptr;
     updateDepth(TLC);
   }
+
+  // The cycle tree and the block-to-innermost-cycle map are complete; lay out
+  // every cycle's blocks into the shared contiguous BlockLayout.
+  Info.layoutBlocks(BlockPreorder);
 }
 
 /// \brief Recompute depth values of \p SubTree and all descendants.
@@ -467,58 +531,56 @@ void GenericCycleInfoCompute<ContextT>::updateDepth(CycleT *SubTree) {
 /// Fills BlockDFSInfo with start/end counters and BlockPreorder.
 template <typename ContextT>
 void GenericCycleInfoCompute<ContextT>::dfs(FunctionT *F, BlockT *EntryBlock) {
-  SmallVector<unsigned, 8> DFSTreeStack;
-  SmallVector<BlockT *, 8> TraverseStack;
+  BlockDFSInfo.resize(GraphTraits<FunctionT *>::getMaxNumber(F));
+
+  // Successors are visited in reverse order to match the legacy
+  // single-LIFO-stack traversal, keeping cycle identification and block order
+  // unchanged.
+  using SuccIt = decltype(successors(EntryBlock).begin());
+  struct Frame {
+    BlockT *Block;
+    std::reverse_iterator<SuccIt> Cur, End;
+  };
+  SmallVector<Frame, 8> Stack;
   unsigned Counter = 0;
-  TraverseStack.emplace_back(EntryBlock);
 
-  BlockDFSInfo.resize(GraphTraits<FunctionT *>::getMaxNumber(F));
-  do {
-    BlockT *Block = TraverseStack.back();
+  auto open = [&](BlockT *Block) {
+    getOrInsertDFSInfo(Block).Start = ++Counter;
+    BlockPreorder.push_back(Block);
     LLVM_DEBUG(errs() << "DFS visiting block: " << Info.Context.print(Block)
-                      << "\n");
-    DFSInfo &Info = getOrInsertDFSInfo(Block);
-    if (Info.Start == 0) {
-      Info.Start = ++Counter;
-
-      // We're visiting the block for the first time. Open its DFSInfo, add
-      // successors to the traversal stack, and remember the traversal stack
-      // depth at which the block was opened, so that we can correctly record
-      // its end time.
-      LLVM_DEBUG(errs() << "  first encountered at depth "
-                        << TraverseStack.size() << "\n");
-
-      DFSTreeStack.emplace_back(TraverseStack.size());
-      llvm::append_range(TraverseStack, successors(Block));
-
-      BlockPreorder.push_back(Block);
-      LLVM_DEBUG(errs() << "  preorder number: " << Counter << "\n");
-    } else {
-      assert(!DFSTreeStack.empty());
-      if (DFSTreeStack.back() == TraverseStack.size()) {
-        LLVM_DEBUG(errs() << "  ended at " << Counter << "\n");
-        Info.End = Counter;
-        DFSTreeStack.pop_back();
-      } else {
-        LLVM_DEBUG(errs() << "  already done\n");
+                      << ", preorder number: " << Counter << "\n");
+    auto Succs = successors(Block);
+    Stack.push_back({Block, std::make_reverse_iterator(Succs.end()),
+                     std::make_reverse_iterator(Succs.begin())});
+  };
+
+  open(EntryBlock);
+  while (!Stack.empty()) {
+    Frame &Top = Stack.back();
+    BlockT *Next = nullptr;
+    while (Top.Cur != Top.End) {
+      BlockT *Succ = *Top.Cur++;
+      if (getOrInsertDFSInfo(Succ).Start == 0) {
+        Next = Succ;
+        break;
       }
-      TraverseStack.pop_back();
     }
-  } while (!TraverseStack.empty());
-  assert(DFSTreeStack.empty());
-
-  LLVM_DEBUG(
-    errs() << "Preorder:\n";
-    for (int i = 0, e = BlockPreorder.size(); i != e; ++i) {
-      errs() << "  " << Info.Context.print(BlockPreorder[i]) << ": " << i << "\n";
+    if (Next) {
+      open(Next);
+    } else {
+      // Top's subtree is complete. Its end counter is the largest preorder
+      // number in the subtree.
+      getOrInsertDFSInfo(Top.Block).End = Counter;
+      Stack.pop_back();
     }
-  );
+  }
 }
 
 /// \brief Reset the object to its initial state.
 template <typename ContextT> void GenericCycleInfo<ContextT>::clear() {
   TopLevelCycles.clear();
   BlockMap.clear();
+  BlockLayout.clear();
 }
 
 /// \brief Compute the cycle info for a function.
diff --git a/llvm/include/llvm/ADT/GenericCycleInfo.h b/llvm/include/llvm/ADT/GenericCycleInfo.h
index cf1f006c3fe5c..c3093d4cf83e5 100644
--- a/llvm/include/llvm/ADT/GenericCycleInfo.h
+++ b/llvm/include/llvm/ADT/GenericCycleInfo.h
@@ -66,11 +66,14 @@ template <typename ContextT> class GenericCycle {
   /// Child cycles, if any.
   std::vector<std::unique_ptr<GenericCycle>> Children;
 
-  /// Basic blocks that are contained in the cycle, including entry blocks,
-  /// and including blocks that are part of a child cycle.
-  using BlockSetVectorT = SetVector<BlockT *, SmallVector<BlockT *, 8>,
-                                    DenseSet<const BlockT *>, 8>;
-  BlockSetVectorT Blocks;
+  /// This cycle's blocks (its own and its nested cycles') occupy the half-open
+  /// range [IdxBegin, IdxEnd) of GenericCycleInfo::BlockLayout. The
+  /// ranges are nested like an Euler tour of the cycle tree, so containment is
+  /// an interval test (see contains()).
+  ///
+  /// During construction (before layoutBlocks), IdxEnd accumulates the number
+  /// of this cycle's own blocks (those whose innermost cycle is this one).
+  unsigned IdxBegin = 0, IdxEnd = 0;
 
   /// Depth of the cycle in the tree. The root "cycle" is at depth 0.
   ///
@@ -79,13 +82,16 @@ template <typename ContextT> class GenericCycle {
   ///       always have the same depth.
   unsigned Depth = 0;
 
+  /// The cycle info that owns this cycle. Used by contains(BlockT*).
+  const GenericCycleInfo<ContextT> *CI = nullptr;
+
   /// Cache for the results of GetExitBlocks
   mutable SmallVector<BlockT *, 4> ExitBlocksCache;
 
   void clear() {
     Entries.clear();
     Children.clear();
-    Blocks.clear();
+    IdxBegin = IdxEnd = 0;
     Depth = 0;
     ParentCycle = nullptr;
     clearCache();
@@ -96,11 +102,6 @@ template <typename ContextT> class GenericCycle {
     clearCache();
   }
 
-  void appendBlock(BlockT *Block) {
-    Blocks.insert(Block);
-    clearCache();
-  }
-
   GenericCycle(const GenericCycle &) = delete;
   GenericCycle &operator=(const GenericCycle &) = delete;
   GenericCycle(GenericCycle &&Rhs) = delete;
@@ -136,13 +137,11 @@ template <typename ContextT> class GenericCycle {
     clearCache();
   }
 
-  /// \brief Return whether \p Block is contained in the cycle.
-  bool contains(const BlockT *Block) const { return Blocks.contains(Block); }
+  /// \brief Return whether \p Block is contained in the cycle. O(1).
+  bool contains(const BlockT *Block) const;
 
-  /// \brief Returns true iff this cycle contains \p C.
-  ///
-  /// Note: Non-strict containment check, i.e. returns true if C is the
-  /// same cycle.
+  /// \brief Returns true iff this cycle contains \p C. O(1). Non-strict, i.e.
+  /// returns true if C is the same cycle.
   bool contains(const GenericCycle *C) const;
 
   const GenericCycle *getParentCycle() const { return ParentCycle; }
@@ -203,15 +202,12 @@ template <typename ContextT> class GenericCycle {
 
   /// Iteration over blocks in the cycle (including entry blocks).
   //@{
-  using const_block_iterator = typename BlockSetVectorT::const_iterator;
+  using const_block_iterator =
+      typename SmallVector<BlockT *, 8>::const_iterator;
 
-  const_block_iterator block_begin() const {
-    return const_block_iterator{Blocks.begin()};
-  }
-  const_block_iterator block_end() const {
-    return const_block_iterator{Blocks.end()};
-  }
-  size_t getNumBlocks() const { return Blocks.size(); }
+  const_block_iterator block_begin() const;
+  const_block_iterator block_end() const;
+  size_t getNumBlocks() const { return IdxEnd - IdxBegin; }
   iterator_range<const_block_iterator> blocks() const {
     return llvm::make_range(block_begin(), block_end());
   }
@@ -245,7 +241,7 @@ template <typename ContextT> class GenericCycle {
     return Printable([this, &Ctx](raw_ostream &Out) {
       Out << "depth=" << Depth << ": entries(" << printEntries(Ctx) << ')';
 
-      for (auto *Block : Blocks) {
+      for (auto *Block : blocks()) {
         if (isEntry(Block))
           continue;
 
@@ -271,6 +267,10 @@ template <typename ContextT> class GenericCycleInfo {
   /// Map basic block numbers to their inner-most containing cycle.
   SmallVector<CycleT *> BlockMap;
 
+  /// Euler tour of the cycle forest: every cycle's blocks form a contiguous
+  /// slice [IdxBegin, IdxEnd) of this array, nested inside its parent's.
+  SmallVector<BlockT *, 8> BlockLayout;
+
   /// Top-level cycles discovered by any DFS.
   ///
   /// Note: The implementation treats the nullptr as the parent of
@@ -286,10 +286,35 @@ template <typename ContextT> class GenericCycleInfo {
   void verifyBlockNumberEpoch(const FunctionT *Fn) const;
   void addToBlockMap(BlockT *Block, CycleT *Cycle);
 
+  /// Build BlockLayout and every cycle's [IdxBegin, IdxEnd) slice
+  /// from the innermost-cycle map and the current cycle tree.
+  void layoutBlocks(ArrayRef<BlockT *> Order);
+
 public:
   GenericCycleInfo() = default;
-  GenericCycleInfo(GenericCycleInfo &&) = default;
-  GenericCycleInfo &operator=(GenericCycleInfo &&) = default;
+  GenericCycleInfo(GenericCycleInfo &&Other) { *this = std::move(Other); }
+  GenericCycleInfo &operator=(GenericCycleInfo &&Other) {
+    if (this == &Other)
+      return *this;
+    Context = std::move(Other.Context);
+    BlockNumberEpoch = Other.BlockNumberEpoch;
+    BlockMap = std::move(Other.BlockMap);
+    BlockLayout = std::move(Other.BlockLayout);
+    TopLevelCycles = std::move(Other.TopLevelCycles);
+    // The moved cycles carry a back-reference to their owning info (used by
+    // GenericCycle::contains(BlockT*) and blocks()); re-point it at this
+    // object.
+    SmallVector<CycleT *, 8> Worklist;
+    for (auto &TLC : TopLevelCycles)
+      Worklist.push_back(TLC.get());
+    while (!Worklist.empty()) {
+      CycleT *C = Worklist.pop_back_val();
+      C->CI = this;
+      for (auto &Child : C->Children)
+        Worklist.push_back(Child.get());
+    }
+    return *this;
+  }
 
   void clear();
   void compute(FunctionT &F);
diff --git a/llvm/test/Analysis/CycleInfo/basic.ll b/llvm/test/Analysis/CycleInfo/basic.ll
index 33e5227b162fd..240722b9f3788 100644
--- a/llvm/test/Analysis/CycleInfo/basic.ll
+++ b/llvm/test/Analysis/CycleInfo/basic.ll
@@ -204,7 +204,7 @@ exit:
 
 define void @irreducible_into_simple_cycle(i1 %arg) {
 ; CHECK-LABEL: CycleInfo for function: irreducible_into_simple_cycle
-; CHECK:           depth=1: entries(F C A) E D B
+; CHECK:           depth=1: entries(F C A) B D E
 entry:
   switch i32 undef, label %A [ i32 0, label %C
                                i32 1, label %F ]
diff --git a/llvm/test/Analysis/CycleInfo/unreachable-predecessor.ll b/llvm/test/Analysis/CycleInfo/unreachable-predecessor.ll
index 17114de7d0f2d..0f72ba22c26be 100644
--- a/llvm/test/Analysis/CycleInfo/unreachable-predecessor.ll
+++ b/llvm/test/Analysis/CycleInfo/unreachable-predecessor.ll
@@ -1,6 +1,6 @@
 ; RUN: opt < %s -disable-output -passes='verify<cycles>,print<cycles>' 2>&1 | FileCheck %s
 ; CHECK-LABEL: CycleInfo for function: unreachable
-; CHECK:    depth=1: entries(loop.body) loop.latch inner.block
+; CHECK:    depth=1: entries(loop.body) inner.block loop.latch
 define void @unreachable(i32 %n, i1 %arg) {
 entry:
   br label %loop.body
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/branch-outside.ll b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/branch-outside.ll
index 92e98e28c7f8d..8ac0093e6154b 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/branch-outside.ll
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/branch-outside.ll
@@ -39,7 +39,7 @@ exit:
 
 ; CHECK=LABEL: UniformityInfo for function 'nested':
 ; CHECK: CYCLES ASSUMED DIVERGENT:
-; CHECK:  depth=1: entries(P T) Q A C B
+; CHECK:  depth=1: entries(P T) Q A B C
 define amdgpu_kernel void @nested(i32 %a, i32 %b, i32 %c) {
 entry:
  %cond.uni = icmp slt i32 %a, 0
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers-nested.ll b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers-nested.ll
index 35a165db54862..4c4a4f8a38106 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers-nested.ll
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers-nested.ll
@@ -127,7 +127,7 @@ exit:
 ;;
 ;; CHECK-LABEL: UniformityInfo for function 'headers_b_t':
 ;; CHECK: CYCLES ASSUMED DIVERGENT:
-;; CHECK:   depth=2: entries(T P) S Q R
+;; CHECK:   depth=2: entries(T P) Q R S
 ;; CHECK-NOT: CYCLES WITH DIVERGENT EXIT:
 
 define amdgpu_kernel void @headers_b_t(i32 %a, i32 %b, i32 %c) {
@@ -185,7 +185,7 @@ exit:
 ;;
 ;; CHECK-LABEL: UniformityInfo for function 'headers_a_t':
 ;; CHECK: CYCLES ASSUMED DIVERGENT:
-;; CHECK:   depth=1: entries(A B) D T S Q P R C
+;; CHECK:   depth=1: entries(A B) D C T P Q R S
 ;; CHECK-NOT: CYCLES WITH DIVERGENT EXIT:
 
 define amdgpu_kernel void @headers_a_t(i32 %a, i32 %b, i32 %c) {
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers.ll b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers.ll
index 6d1a95b71ea52..50f5c101a5672 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers.ll
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/diverged-entry-headers.ll
@@ -11,7 +11,7 @@
 ;;
 ;; CHECK-LABEL: UniformityInfo for function 't_header':
 ;; CHECK: CYCLES ASSUMED DIVERGENT:
-;; CHECK:   depth=1: entries(T P) S Q R
+;; CHECK:   depth=1: entries(T P) Q R S
 
 define amdgpu_kernel void @t_header(i32 %a, i32 %b, i32 %c) {
 entry:
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/exit-divergence.ll b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/exit-divergence.ll
index 784f58eb3fed8..3418543da3255 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/irreducible/exit-divergence.ll
+++...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/208614


More information about the llvm-commits mailing list