Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Support/GenericDomTree.cpp
//===- GenericDomTree.cpp - Generic dominator trees for graphs --*- C++ -*-===// | //===- GenericDomTree.cpp - Generic dominator trees for graphs --*- C++ -*-===// | ||||
Lint: Lint: clang-format not found in user's PATH; not linting file. | |||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | GenericDominatorTreeBase::findNearestCommonDominatorBlock(CfgBlockRef A, | ||||
assert(A && B && "Pointers are not valid"); | assert(A && B && "Pointers are not valid"); | ||||
const GenericDomTreeNodeBase *Dom = | const GenericDomTreeNodeBase *Dom = | ||||
findNearestCommonDominator(getNode(A), getNode(B)); | findNearestCommonDominator(getNode(A), getNode(B)); | ||||
return Dom ? Dom->getBlock() : CfgBlockRef(); | return Dom ? Dom->getBlock() : CfgBlockRef(); | ||||
} | } | ||||
/// findSiblingOfUncle - Under the assumption that \p Uncle is the sibling | |||||
/// of some ancestor of \p A in the tree, find that ancestor. Also handles | |||||
/// the degenerate case where \p A itself is a sibling of \p Uncle. | |||||
arsenmUnsubmitted Not Done ReplyInline ActionsShould go in header? arsenm: Should go in header? | |||||
const GenericDomTreeNodeBase *GenericDominatorTreeBase::findSiblingOfUncle( | |||||
arsenmUnsubmitted Not Done ReplyInline ActionsI'm not sure these are the right family analogies. This could also find a great uncle, or the same parent. arsenm: I'm not sure these are the right family analogies. This could also find a great uncle, or the… | |||||
nhaehnleAuthorUnsubmitted Fair enough, do you have a suggestion for a better name? findSiblingOfNthUncle perhaps? nhaehnle: Fair enough, do you have a suggestion for a better name? `findSiblingOfNthUncle` perhaps? | |||||
arsenmUnsubmitted Not Done ReplyInline ActionsI don't really have a better idea. The comment could maybe explain more of the cases it can encounter? "some ancestor" is a bit vague. arsenm: I don't really have a better idea. The comment could maybe explain more of the cases it can… | |||||
kuharUnsubmitted Not Done ReplyInline ActionsI agree with arsenm, the naming is unfortunate. Maybe climbUntilSiblings? Whatever name we settle on here, I think an ascii art with an example would really help here. kuhar: I agree with arsenm, the naming is unfortunate. Maybe `climbUntilSiblings`?
Whatever name we… | |||||
const GenericDomTreeNodeBase *A, | |||||
const GenericDomTreeNodeBase *Uncle) const { | |||||
assert(A && Uncle && "Pointers are not valid"); | |||||
// Use level information to go up the tree until the levels match. | |||||
assert(A->getLevel() >= Uncle->getLevel()); | |||||
while (A->getLevel() > Uncle->getLevel()) | |||||
A = A->IDom; | |||||
assert(A->IDom == Uncle->IDom && "Uncle was not in fact an uncle"); | |||||
return A; | |||||
} | |||||
/// updateDFSNumbers - Assign In and Out numbers to the nodes while walking | /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking | ||||
/// dominator tree in dfs order. | /// dominator tree in dfs order. | ||||
void GenericDominatorTreeBase::updateDFSNumbers() const { | void GenericDominatorTreeBase::updateDFSNumbers() const { | ||||
if (DFSInfoValid) { | if (DFSInfoValid) { | ||||
SlowQueries = 0; | SlowQueries = 0; | ||||
return; | return; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |
clang-format not found in user's PATH; not linting file.