[llvm] [Support][NFC] Simplify DomTreeNodeBase::addChild (PR #101056)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 12:55:40 PDT 2024


================
@@ -831,9 +827,10 @@ class DominatorTreeBase {
   void addRoot(NodeT *BB) { this->Roots.push_back(BB); }
 
   DomTreeNodeBase<NodeT> *createChild(NodeT *BB, DomTreeNodeBase<NodeT> *IDom) {
-    return (DomTreeNodes[BB] = IDom->addChild(
-                std::make_unique<DomTreeNodeBase<NodeT>>(BB, IDom)))
-        .get();
+    auto Node = std::make_unique<DomTreeNodeBase<NodeT>>(BB, IDom);
+    auto *NodePtr = (DomTreeNodes[BB] = std::move(Node)).get();
+    IDom->addChild(NodePtr);
+    return NodePtr;
----------------
kuhar wrote:

+1

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


More information about the llvm-commits mailing list