[llvm] [Support][NFC] Use single predecessor array in DomTreeConstr (PR #207535)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 4 17:40:03 PDT 2026


================
@@ -314,8 +319,12 @@ template <typename DomTreeT> struct SemiNCAInfo {
 
       // Initialize the semi dominator to point to the parent node.
       WInfo.Semi = WInfo.Parent;
-      for (unsigned N : WInfo.ReverseChildren) {
-        unsigned SemiU = NumToInfo[eval(N, i + 1, EvalStack, NumToInfo)]->Semi;
+      unsigned RCIdx = WInfo.ReverseChildrenStart;
----------------
MaskRay wrote:

Use a variant that avoids the index-0 sentinel?

I can rebase https://github.com/llvm/llvm-project/pull/207524 after this PR lands.
```cpp
      for (unsigned RCIdx = WInfo.ReverseChildrenHead; RCIdx != 0;) {
        auto [Pred, NextIdx] = ReverseChildren[RCIdx - 1];
        unsigned SemiU =
            NumToInfo[eval(Pred, i + 1, EvalStack, NumToInfo)]->Semi;
        if (SemiU < WInfo.Semi)
          WInfo.Semi = SemiU;
        RCIdx = NextIdx;
      }
```

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


More information about the llvm-commits mailing list