[llvm-commits] [PATCH] Added topological graph sort routine to llvm/ADT

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Aug 17 22:00:10 PDT 2011


On Aug 17, 2011, at 9:17 PM, Chandler Carruth wrote:

> On Wed, Aug 17, 2011 at 8:56 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
> 
> On Aug 17, 2011, at 3:52 PM, Delesley Hutchins wrote:
> 
> > This patch adds a topological sort routine for indexed graphs to
> > llvm/ADT.  This sort routine is currently used to traverse CFGs in
> > Clang when doing thread safety analysis (patch to be released
> > shortly).
> 
> Could you explain why we need this in addition to include/llvm/ADT/PostOrderIterator.h?
> 
> FYI, I'm not terribly familiar w/ PostOrderIterator (so maybe it would actually serve here), but JSYK, the motivating use case is in a Clang patch: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110815/045262.html

I see.

AFAICT, the existing RPO iterator will give you the exact same ordering of blocks, at least it will give you a topo-sort of the graph after removing back-edges.

You can detect back-edges by keeping track of visited blocks in a BitVector as you iterate through the RPO.

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110817/220ff8ff/attachment.html>


More information about the llvm-commits mailing list