From c63d4c2e4e43add22b5cc6a41a93cfa83368f15f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 8 Aug 2007 05:51:24 +0000 Subject: reimplement dfs number computation to be significantly faster. This speeds up natural loop canonicalization (which does many cfg xforms) by 4.3x, for example. This also fixes a bug in postdom dfnumber computation. llvm-svn: 40920 --- llvm/lib/Analysis/PostDominators.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'llvm/lib/Analysis/PostDominators.cpp') diff --git a/llvm/lib/Analysis/PostDominators.cpp b/llvm/lib/Analysis/PostDominators.cpp index 4622441e06b..69e9cbe26b8 100644 --- a/llvm/lib/Analysis/PostDominators.cpp +++ b/llvm/lib/Analysis/PostDominators.cpp @@ -193,15 +193,9 @@ void PostDominatorTree::calculate(Function &F) { Info.clear(); std::vector().swap(Vertex); - int dfsnum = 0; - // Iterate over all nodes in depth first order... - for (unsigned i = 0, e = Roots.size(); i != e; ++i) - for (idf_iterator I = idf_begin(Roots[i]), - E = idf_end(Roots[i]); I != E; ++I) { - if (!getNodeForBlock(*I)->getIDom()) - getNodeForBlock(*I)->assignDFSNumber(dfsnum); - } - DFSInfoValid = true; + // Start out with the DFS numbers being invalid. Let them be computed if + // demanded. + DFSInfoValid = false; } -- cgit v1.2.3