<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 26, 2011, at 1:13 AM, Chandler Carruth wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">YES. I would greatly appreciate making an RPO order guarantee at the loop info and/or function layer from an analysis that I can piggyback on. Doing it at the loop layer would be wonderful for implementing this kind of algorithm.</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "> </div><blockquote class="gmail_quote" style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; 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; ">You're currently sidestepping the<br>issue by placing chains in a single iteration through the function's<br>blocks. If that works well, I don't have a problem with it, but it<br>seems to complicate the issue of loop layout. For example, our simple<br>RPO iterator makes no attempt to visit blocks in loop order, so<br>following this order will not result in contiguous loops. I think<br>laying out one loop at a time is much easier to deal with. If you want<br>to follow blocks within a loop in RPO order, you can use the<br>LoopIterator that I recently added for this purpose. It does need to<br>be adapted for MachineLoopInfo.</blockquote><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">I'll look into LoopIterator. If it were to get adapted for MachineLoopInfo, that would certainly help. =D</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">I wonder however, the Loop object already has a vector of BB*; it would seem like it could just place that vector in RPO, and be done with it? Dunno, as I've not looked at LoopIterator, etc.</div></blockquote></div><br><div>Totally agreed. I don't think we can guarantee the Loop's blocks are RPO at all times, but a particular pass could sort the blocks up front. We have to be careful that some underlying CFG utility doesn't invalidate the order. But giving LoopIterator a separate blocks list doesn't really solve that problem, just hides it.</div><div><br></div><div>If it will help you, I can throw together a patch to provides a MachineLoopIterator. That should be straightforward. Later, if need be, someone can modify it to sort the original Loop blocks instead of maintaining its own list as an optimization.</div><div><br></div><div>-Andy</div></body></html>