[PATCH] D88758: [DomTree] findNearestCommonDominator: assert the nodes are in tree
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 15:02:56 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: asbirlea, dblaikie, kuhar.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
MaskRay requested review of this revision.
i.e. they cannot be unreachable from the entry (which usually indicate usage errors).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88758
Files:
llvm/include/llvm/Support/GenericDomTree.h
Index: llvm/include/llvm/Support/GenericDomTree.h
===================================================================
--- llvm/include/llvm/Support/GenericDomTree.h
+++ llvm/include/llvm/Support/GenericDomTree.h
@@ -480,8 +480,7 @@
DomTreeNodeBase<NodeT> *NodeA = getNode(A);
DomTreeNodeBase<NodeT> *NodeB = getNode(B);
-
- if (!NodeA || !NodeB) return nullptr;
+ assert(NodeA && NodeB);
// Use level information to go up the tree until the levels match. Then
// continue going up til we arrive at the same node.
@@ -491,7 +490,7 @@
NodeA = NodeA->IDom;
}
- return NodeA ? NodeA->getBlock() : nullptr;
+ return NodeA->getBlock();
}
const NodeT *findNearestCommonDominator(const NodeT *A,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88758.295919.patch
Type: text/x-patch
Size: 746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201002/1765e886/attachment.bin>
More information about the llvm-commits
mailing list