[llvm] [DomTreeUpdater] Move critical edge splitting code to updater (PR #115111)

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 06:03:19 PST 2024


================
@@ -229,57 +246,58 @@ GenericDomTreeUpdater<DerivedT, DomTreeT, PostDomTreeT>::dump() const {
   }
 
   OS << "Pending DeletedBBs:\n";
-  Index = 0;
-  for (const auto *BB : DeletedBBs) {
+  for (auto [Index, BB] : enumerate(DeletedBBs)) {
     OS << "  " << Index << " : ";
-    ++Index;
     if (BB->hasName())
       OS << BB->getName() << "(";
     else
-      OS << "(no_name)(";
+      OS << "(no name)(";
     OS << BB << ")\n";
   }
 #endif
 }
 
 template <typename DerivedT, typename DomTreeT, typename PostDomTreeT>
+template <bool IsForward>
 void GenericDomTreeUpdater<DerivedT, DomTreeT,
-                           PostDomTreeT>::applyDomTreeUpdates() {
+                           PostDomTreeT>::applyUpdatesImpl() {
+  auto *DomTree = [&]() {
+    if constexpr (IsForward)
+      return DT;
+    else
----------------
qcolombet wrote:

Nit: no else after return

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


More information about the llvm-commits mailing list