[llvm] [Support] Store dominator tree nodes in a vector (PR #101705)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 06:07:08 PDT 2024


================
@@ -786,17 +828,48 @@ class DominatorTreeBase {
     DFSInfoValid = true;
   }
 
+private:
+  template <class T_ = NodeT> void updateBlockNumberEpoch() {
+    // Nothing to do for graphs that don't number their blocks.
+    if constexpr (is_detected<has_number_t, T_>::value)
+      BlockNumberEpoch = GraphTraits<ParentPtr>::getNumberEpoch(Parent);
+  }
+
+public:
   /// recalculate - compute a dominator tree for the given function
   void recalculate(ParentType &Func) {
     Parent = &Func;
+    updateBlockNumberEpoch();
     DomTreeBuilder::Calculate(*this);
   }
 
   void recalculate(ParentType &Func, ArrayRef<UpdateType> Updates) {
     Parent = &Func;
+    updateBlockNumberEpoch();
     DomTreeBuilder::CalculateWithUpdates(*this, Updates);
   }
 
+  /// Update dominator tree after renumbering blocks
----------------
nikic wrote:

```suggestion
  /// Update dominator tree after renumbering blocks.
```

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


More information about the llvm-commits mailing list