[llvm-commits] Review request: dominance frontier computation speedup
Daniel Berlin
dberlin at dberlin.org
Wed Nov 24 20:04:49 PST 2010
On Wed, Nov 24, 2010 at 2:16 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:
>
> On Nov 23, 2010, at 9:27 PM, Cameron Zwarich wrote:
>
> > There aren't very many good use cases for std::set. Most dominance
> frontiers are small, so a SmallPtrSet seemed like a good choice. I
> experimented with different small values of the inline capacity and found
> that 2 was best for performance.
>
> Does the majority of sets really have only 2 or less members? Otherwise, a
> DenseSet might be better.
>
Dominance frontiers for each CFG node tend to be quite small in most CFG's.
Remember that the the dominance frontier of node N is the set of nodes that
n dominates an immediate predecessor of, but not that node itself.
IE the set of nodes where n's dominance stops.
The common case of this is a merge point in the CFG. Most merge points only
have two predecessors, and thus, the max set size of the dominance frontier
is usually 2.
You can probably get a good guess at max size by using the maximum number of
incoming edges any node has, though in theory the dominance frontier for a
given CFG node could contain every other CFG node minus some constant factor
(Without thinking too hard, i believe you can achieve this with a really
large switch statement being the only thing in the function).
--Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20101124/7409c62a/attachment.html>
More information about the llvm-commits
mailing list