[PATCH] D46709: [Dominators] Add PDT constructor from Function
Chijun Sima via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 10 11:20:35 PDT 2018
NutshellySima created this revision.
NutshellySima added reviewers: davide, kuhar, grosser, dberlin.
Herald added a subscriber: llvm-commits.
This patch adds a PDT constructor from Function and let codes previously using a local class to do this use PostDominatorTree class directly.
Repository:
rL LLVM
https://reviews.llvm.org/D46709
Files:
include/llvm/Analysis/PostDominators.h
unittests/IR/DominatorTreeBatchUpdatesTest.cpp
unittests/IR/DominatorTreeTest.cpp
Index: unittests/IR/DominatorTreeTest.cpp
===================================================================
--- unittests/IR/DominatorTreeTest.cpp
+++ unittests/IR/DominatorTreeTest.cpp
@@ -21,9 +21,7 @@
using namespace llvm;
-struct PostDomTree : PostDomTreeBase<BasicBlock> {
- PostDomTree(Function &F) { recalculate(F); }
-};
+using PostDomTree = PostDominatorTree;
/// Build the dominator tree for the function and run the Test.
static void runWithDomTree(
Index: unittests/IR/DominatorTreeBatchUpdatesTest.cpp
===================================================================
--- unittests/IR/DominatorTreeBatchUpdatesTest.cpp
+++ unittests/IR/DominatorTreeBatchUpdatesTest.cpp
@@ -22,9 +22,7 @@
const auto CFGInsert = CFGBuilder::ActionKind::Insert;
const auto CFGDelete = CFGBuilder::ActionKind::Delete;
-struct PostDomTree : PostDomTreeBase<BasicBlock> {
- PostDomTree(Function &F) { recalculate(F); }
-};
+using PostDomTree = PostDominatorTree;
using DomUpdate = DominatorTree::UpdateType;
static_assert(
Index: include/llvm/Analysis/PostDominators.h
===================================================================
--- include/llvm/Analysis/PostDominators.h
+++ include/llvm/Analysis/PostDominators.h
@@ -29,7 +29,8 @@
class PostDominatorTree : public PostDomTreeBase<BasicBlock> {
public:
using Base = PostDomTreeBase<BasicBlock>;
-
+ PostDominatorTree() = default;
+ explicit PostDominatorTree(Function &F) { recalculate(F); }
/// Handle invalidation explicitly.
bool invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46709.146166.patch
Type: text/x-patch
Size: 1632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180510/4306cfd9/attachment.bin>
More information about the llvm-commits
mailing list