[llvm] [Support][NFCI] Store DomTree children as linked list (PR #176409)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 17 09:00:04 PST 2026
================
@@ -60,25 +60,45 @@ template <class NodeT> class DomTreeNodeBase {
NodeT *TheBB;
DomTreeNodeBase *IDom;
unsigned Level;
- SmallVector<DomTreeNodeBase *, 4> Children;
+ DomTreeNodeBase *FirstChild = nullptr;
+ DomTreeNodeBase *Sibling = nullptr;
+ DomTreeNodeBase **AppendPtr = &FirstChild;
----------------
aengelke wrote:
I still see no benefit from splitting the class. GenericDomTree is already separated from GenericDomTreeConstruction. IMO, further subclasses increase code complexity (ilist is a particularly extreme example for this, I remember spending many hours reading and debugging ilist code, which I found pretty convoluted). There is no other user that would reuse the code and DomTreeNodeBase is/remains pretty close to a bare bone tree node implementation.
Should you consider the existing DomTree testing as truly insufficient, I can add a case to GenericDomTreeTest that specifically exercises addNode/removeNode.
https://github.com/llvm/llvm-project/pull/176409
More information about the llvm-commits
mailing list