[llvm] [CycleInfo] Represent cycles by an opaque handle. NFC (PR #210117)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 09:41:35 PDT 2026


MaskRay wrote:

> Sorry if this is a dumb question, I have not been following these patches too closely:
> 
> If cycles are now identified by CycleRef which wraps an integer, does that mean we no longer need pointer stability for the array of cycles, and does that mean we can stop using deque in GenericCycleImpl? (This is just my personal prejudice against deque -- I think it is almost never a good idea to use it.)

> Yes, I think that's the plan. (I also dislike deque.)

```
  /// Append-only cycles discovered so far, in creation order.
  std::deque<CycleT> AllCycles;
```
is chosen as it delivers better performance than `SmallVector<unique_ptr<CycleT>, N>`. Yes that pointer stability is no longer needed and a plain SmallVector can be used. The plan is to switch to a different loop identification algorithm recommended by @aengelke 
https://gist.github.com/MaskRay/5872ef6af7e78d4329c3e85cc1957638

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


More information about the llvm-commits mailing list