[PATCH] D142162: [Dominators] Use GraphTraits::getEntryNode instead of front(). (NFC)
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 19 15:23:20 PST 2023
fhahn created this revision.
fhahn added reviewers: Ayal, kuhar, foad, asbirlea, nhaehnle.
Herald added subscribers: StephenFan, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: pcwang-thead, vkmr.
Herald added a project: LLVM.
'front' is a specific interface of llvm::Function/MachineFunction. To make
DominatorTreeBase usable with types where front() is not defined, use
GraphTraits::getEntryNode instead.
The main motivation for this patch is using DominatorTreeBase across all
regions of a VPlan, see D140513 <https://reviews.llvm.org/D140513>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142162
Files:
llvm/include/llvm/Support/GenericDomTree.h
llvm/lib/Transforms/Vectorize/VPlan.h
Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -2111,12 +2111,6 @@
EntryBlock->setParent(this);
}
- // FIXME: DominatorTreeBase is doing 'A->getParent()->front()'. 'front' is a
- // specific interface of llvm::Function, instead of using
- // GraphTraints::getEntryNode. We should add a new template parameter to
- // DominatorTreeBase representing the Graph type.
- VPBlockBase &front() const { return *Entry; }
-
const VPBlockBase *getExiting() const { return Exiting; }
VPBlockBase *getExiting() { return Exiting; }
Index: llvm/include/llvm/Support/GenericDomTree.h
===================================================================
--- llvm/include/llvm/Support/GenericDomTree.h
+++ llvm/include/llvm/Support/GenericDomTree.h
@@ -473,7 +473,7 @@
// If either A or B is a entry block then it is nearest common dominator
// (for forward-dominators).
if (!isPostDominator()) {
- NodeT &Entry = A->getParent()->front();
+ NodeT &Entry = *GraphTraits<NodeT *>::getEntryNode(A);
if (A == &Entry || B == &Entry)
return &Entry;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142162.490674.patch
Type: text/x-patch
Size: 1248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230119/7b2072b8/attachment.bin>
More information about the llvm-commits
mailing list