[llvm] 4180e2b - [UniformityAnalysis] Make divergent-exit cycle print order deterministic (#210107)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 10:16:04 PDT 2026
Author: Fangrui Song
Date: 2026-07-16T10:15:59-07:00
New Revision: 4180e2bb885271956e80344354b046a9b4cf3031
URL: https://github.com/llvm/llvm-project/commit/4180e2bb885271956e80344354b046a9b4cf3031
DIFF: https://github.com/llvm/llvm-project/commit/4180e2bb885271956e80344354b046a9b4cf3031.diff
LOG: [UniformityAnalysis] Make divergent-exit cycle print order deterministic (#210107)
Once the set spills to the heap its iteration order follows allocation
addresses, so the printed order is nondeterministic.
Fix https://reviews.llvm.org/D130746 ("RFC: Uniformity Analysis for
Irreducible Control Flow")
Added:
Modified:
llvm/include/llvm/ADT/GenericUniformityImpl.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/GenericUniformityImpl.h b/llvm/include/llvm/ADT/GenericUniformityImpl.h
index 528fe11d8579e..3f78b21edd8a9 100644
--- a/llvm/include/llvm/ADT/GenericUniformityImpl.h
+++ b/llvm/include/llvm/ADT/GenericUniformityImpl.h
@@ -48,6 +48,7 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SparseBitVector.h"
#include "llvm/ADT/StringExtras.h"
@@ -462,7 +463,7 @@ template <typename ContextT> class GenericUniformityAnalysisImpl {
const DominatorTreeT &DT;
// Recognized cycles with divergent exits.
- SmallPtrSet<const CycleT *, 16> DivergentExitCycles;
+ SmallSetVector<const CycleT *, 8> DivergentExitCycles;
// Cycles assumed to be divergent.
//
@@ -919,7 +920,7 @@ void GenericUniformityAnalysisImpl<ContextT>::propagateCycleExitDivergence(
LLVM_DEBUG(dbgs() << "\tOuter-most exiting cycle: "
<< Context.print(CI.getHeader(*OuterDivCycle)) << "\n");
- if (!DivergentExitCycles.insert(OuterDivCycle).second)
+ if (!DivergentExitCycles.insert(OuterDivCycle))
return;
// Exit divergence does not matter if the cycle itself is assumed to
More information about the llvm-commits
mailing list