[llvm] r306778 - [Dominators] Don't compute DFS InOut numbers eagerly.
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 18:28:22 PDT 2017
Author: kuhar
Date: Thu Jun 29 18:28:21 2017
New Revision: 306778
URL: http://llvm.org/viewvc/llvm-project?rev=306778&view=rev
Log:
[Dominators] Don't compute DFS InOut numbers eagerly.
Summary:
DFS InOut numbers currently get eagerly computer upon DomTree construction. They are only needed to answer dome dominance queries and they get invalidated by updates and recalculations. Because of that, it is faster in practice to compute them lazily when they are actually needed.
Clang built without this patch takes 6m 45s to boostrap on my machine, and with the patch applied 6m 38s.
Reviewers: sanjoy, dberlin, chandlerc
Reviewed By: dberlin
Subscribers: davide, llvm-commits
Differential Revision: https://reviews.llvm.org/D34296
Modified:
llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h
llvm/trunk/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll
llvm/trunk/unittests/IR/DominatorTreeTest.cpp
Modified: llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h?rev=306778&r1=306777&r2=306778&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h (original)
+++ llvm/trunk/include/llvm/Support/GenericDomTreeConstruction.h Thu Jun 29 18:28:21 2017
@@ -277,8 +277,6 @@ struct SemiNCAInfo {
DT.DomTreeNodes[W] = IDomNode->addChild(
llvm::make_unique<DomTreeNodeBase<NodeT>>(W, IDomNode));
}
-
- DT.updateDFSNumbers();
}
void doFullDFSWalk(const DomTreeT &DT) {
Modified: llvm/trunk/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll?rev=306778&r1=306777&r2=306778&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll (original)
+++ llvm/trunk/test/Analysis/Dominators/2006-10-02-BreakCritEdges.ll Thu Jun 29 18:28:21 2017
@@ -2,7 +2,7 @@
; RUN: opt < %s -passes='require<domtree>,break-crit-edges,print<domtree>' -disable-output 2>&1| FileCheck %s
; PR932
-; CHECK: [3] %brtrue {1,2}
+; CHECK: [3] %brtrue {{{[0-9]+}},{{[0-9]+}}}
declare void @use1(i32)
Modified: llvm/trunk/unittests/IR/DominatorTreeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/DominatorTreeTest.cpp?rev=306778&r1=306777&r2=306778&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/DominatorTreeTest.cpp (original)
+++ llvm/trunk/unittests/IR/DominatorTreeTest.cpp Thu Jun 29 18:28:21 2017
@@ -220,6 +220,7 @@ TEST(DominatorTree, Unreachable) {
EXPECT_EQ(PostDominatedBBs.size(), 0UL);
// Check DFS Numbers before
+ DT->updateDFSNumbers();
EXPECT_EQ(DT->getNode(BB0)->getDFSNumIn(), 0UL);
EXPECT_EQ(DT->getNode(BB0)->getDFSNumOut(), 7UL);
EXPECT_EQ(DT->getNode(BB1)->getDFSNumIn(), 1UL);
@@ -235,6 +236,7 @@ TEST(DominatorTree, Unreachable) {
DT->recalculate(F);
// Check DFS Numbers after
+ DT->updateDFSNumbers();
EXPECT_EQ(DT->getNode(BB0)->getDFSNumIn(), 0UL);
EXPECT_EQ(DT->getNode(BB0)->getDFSNumOut(), 9UL);
EXPECT_EQ(DT->getNode(BB1)->getDFSNumIn(), 1UL);
More information about the llvm-commits
mailing list