[PATCH] D58349: [Dominators] Fix and optimize edge insertion of depth-based search

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 18 06:39:09 PST 2019


MaskRay created this revision.
MaskRay added a reviewer: kuhar.
Herald added subscribers: llvm-commits, jdoerfert, kristina.
Herald added a project: LLVM.

After (x,y) is inserted, depth-based search finds all affected v that satisfies:

depth(nca(x,y))+1 < depth(v) && there exists a path P from y to v where every w on P satisfies depth(v) <= depth(w)

This reduces to a widest path problem (maximizing the weight of the
minimum vertex in the path) which can be solved by a modified version of
BFS with a bucket queue (Depth-based search as mentioned in the paper).

The algorithm visits vertices in decreasing order of bucket number.
However, the current code misused priority_queue to extract them in
increasing order. I cannot think of a failing scenario but it surely may
process vertices more than once due to the local usage of Processed.

This patch fixes this and simplifies/optimizes the code a bit.


Repository:
  rL LLVM

https://reviews.llvm.org/D58349

Files:
  include/llvm/Support/GenericDomTreeConstruction.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58349.187239.patch
Type: text/x-patch
Size: 5635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190218/d010506d/attachment.bin>


More information about the llvm-commits mailing list