<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 17, 2011, at 9:17 PM, Chandler Carruth wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Wed, Aug 17, 2011 at 8:56 PM, Jakob Stoklund Olesen <span dir="ltr"><<a href="mailto:stoklund@2pi.dk">stoklund@2pi.dk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
<div class="im"><br>
On Aug 17, 2011, at 3:52 PM, Delesley Hutchins wrote:<br>
<br>
> This patch adds a topological sort routine for indexed graphs to<br>
> llvm/ADT.  This sort routine is currently used to traverse CFGs in<br>
> Clang when doing thread safety analysis (patch to be released<br>
> shortly).<br>
<br>
</div>Could you explain why we need this in addition to include/llvm/ADT/PostOrderIterator.h?<br></blockquote><div><br></div><div>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: <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110815/045262.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110815/045262.html</a></div>
</div>
</blockquote></div><br><div>I see.</div><div><br></div><div>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.</div><div><br></div><div>You can detect back-edges by keeping track of visited blocks in a BitVector as you iterate through the RPO.</div><div><br></div><div>/jakob</div><div><br></div></body></html>