[llvm] [CycleInfo] Reference cycles by preorder index, not pointer. NFC (PR #210271)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 23:52:50 PDT 2026
================
@@ -80,12 +80,17 @@ template <typename ContextT> class GenericCycleInfo {
template <typename> friend class GenericCycleInfoCompute;
private:
+ /// Sentinel for a cycle-index slot that refers to no cycle.
+ static constexpr unsigned NoCycle = ~0u;
+
/// Internal, data-only storage for a cycle. Consumers name a cycle by a
/// CycleRef handle and query it through GenericCycleInfo.
class Cycle {
public:
- /// The parent cycle. Is null for top-level cycles.
- Cycle *ParentCycle = nullptr;
+ /// Preorder index of the parent cycle, or NoCycle for a top-level
+ /// cycle. Before flatten() this holds a creation-order index into
+ /// GenericCycleInfoCompute::AllCycles.
+ unsigned ParentIndex = NoCycle;
----------------
MaskRay wrote:
Follow-up: the dual-phase confusion will be fixed by https://github.com/llvm/llvm-project/pull/210491
https://github.com/llvm/llvm-project/pull/210271
More information about the llvm-commits
mailing list