[llvm-commits] [llvm] r122689 - /llvm/trunk/include/llvm/Analysis/DominatorInternals.h
Cameron Zwarich
zwarich at apple.com
Sun Jan 2 02:40:14 PST 2011
Author: zwarich
Date: Sun Jan 2 04:40:14 2011
New Revision: 122689
URL: http://llvm.org/viewvc/llvm-project?rev=122689&view=rev
Log:
Add the explanatory comment from r122680's commit message to the code itself.
Modified:
llvm/trunk/include/llvm/Analysis/DominatorInternals.h
Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=122689&r1=122688&r2=122689&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Sun Jan 2 04:40:14 2011
@@ -195,6 +195,16 @@
// infinite loops). In these cases an artificial exit node is required.
MultipleRoots |= (DT.isPostDominator() && N != F.size());
+ // When naively implemented, the Lengauer-Tarjan algorithm requires a separate
+ // bucket for each vertex. However, this is unnecessary, because each vertex
+ // is only placed into a single bucket (that of its semidominator), and each
+ // vertex's bucket is processed before it is added to any bucket itself.
+ //
+ // Instead of using a bucket per vertex, we use a single array Buckets that
+ // has two purposes. Before the vertex V with preorder number i is processed,
+ // Buckets[i] stores the index of the first element in V's bucket. After V's
+ // bucket is processed, Buckets[i] stores the index of the next element in the
+ // bucket containing V, if any.
std::vector<unsigned> Buckets;
Buckets.resize(N + 1);
for (unsigned i = 1; i <= N; ++i)
More information about the llvm-commits
mailing list