diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-08 05:51:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-08 05:51:24 +0000 |
commit | 3e089ae0b8aa6d9daf0b8ca8f6059422c45936f0 (patch) | |
tree | 1a94bf7be024c94dc78329d4b0c549da4cee182d /lib/Analysis/PostDominators.cpp | |
parent | 6ca4cb37553fc8ab568d1695d2afc99cf100d777 (diff) | |
download | external_llvm-3e089ae0b8aa6d9daf0b8ca8f6059422c45936f0.zip external_llvm-3e089ae0b8aa6d9daf0b8ca8f6059422c45936f0.tar.gz external_llvm-3e089ae0b8aa6d9daf0b8ca8f6059422c45936f0.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40920 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PostDominators.cpp')
-rw-r--r-- | lib/Analysis/PostDominators.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index 4622441..69e9cbe 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -193,15 +193,9 @@ void PostDominatorTree::calculate(Function &F) { Info.clear(); std::vector<BasicBlock*>().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<BasicBlock*> 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; } |