diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:32:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:32:43 +0000 |
commit | b7eb8e35e481a74962664b63dfb09483b200209a (patch) | |
tree | 1937fb4a348458ce2d02ade03ac3bb0aa18d2fcd /include/llvm/Support/GenericDomTree.h | |
parent | eb11fae6d08f479c0799db45860a98af528fa6e7 (diff) | |
download | src-b7eb8e35e481a74962664b63dfb09483b200209a.tar.gz src-b7eb8e35e481a74962664b63dfb09483b200209a.zip |
Vendor import of llvm trunk r338536:vendor/llvm/llvm-trunk-r338536
Notes
Notes:
svn path=/vendor/llvm/dist/; revision=337137
svn path=/vendor/llvm/llvm-trunk-r338536/; revision=337138; tag=vendor/llvm/llvm-trunk-r338536
Diffstat (limited to 'include/llvm/Support/GenericDomTree.h')
-rw-r--r-- | include/llvm/Support/GenericDomTree.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/Support/GenericDomTree.h b/include/llvm/Support/GenericDomTree.h index 115abc23e2c6..c716e4a4d300 100644 --- a/include/llvm/Support/GenericDomTree.h +++ b/include/llvm/Support/GenericDomTree.h @@ -530,11 +530,10 @@ protected: /// CFG about its children and inverse children. This implies that deletions /// of CFG edges must not delete the CFG nodes before calling this function. /// - /// Batch updates should be generally faster when performing longer sequences - /// of updates than calling insertEdge/deleteEdge manually multiple times, as - /// it can reorder the updates and remove redundant ones internally. - /// The batch updater is also able to detect sequences of zero and exactly one - /// update -- it's optimized to do less work in these cases. + /// The applyUpdates function can reorder the updates and remove redundant + /// ones internally. The batch updater is also able to detect sequences of + /// zero and exactly one update -- it's optimized to do less work in these + /// cases. /// /// Note that for postdominators it automatically takes care of applying /// updates on reverse edges internally (so there's no need to swap the @@ -854,10 +853,15 @@ protected: assert(isReachableFromEntry(B)); assert(isReachableFromEntry(A)); + const unsigned ALevel = A->getLevel(); const DomTreeNodeBase<NodeT> *IDom; - while ((IDom = B->getIDom()) != nullptr && IDom != A && IDom != B) + + // Don't walk nodes above A's subtree. When we reach A's level, we must + // either find A or be in some other subtree not dominated by A. + while ((IDom = B->getIDom()) != nullptr && IDom->getLevel() >= ALevel) B = IDom; // Walk up the tree - return IDom != nullptr; + + return B == A; } /// Wipe this tree's state without releasing any resources. |