<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jun 20, 2012, at 6:19 AM, "Rotem, Nadav" <<a href="mailto:nadav.rotem@intel.com">nadav.rotem@intel.com</a>> wrote:</div><blockquote type="cite"><span style="font-family: Helvetica; font-size: medium; 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; display: inline !important; float: none; ">I also noticed that adding basic blocks to all loop-lest levels can result in quadratic runtime.   :(</span></blockquote></div><br><div><div>If the quadratic nature of LoopInfo is a problem, we need to redesign the way it stores its result which would significantly affect (probably improve) the API. I welcome this, but it's outside the scope of my checkin.</div><div><br></div><div>My first implementation (which I was working on until yesterday), inserted blocks in place in RPO order and bulk copied blocks from subloops into parent loops. I got it working but it was excessively complicated and I'm very happy I ditched it.</div><div><br></div><div>We could potentially microoptimize block insertion various ways. We could avoid std::reverse either by changing the LoopInfo result data structure from vector to deque, or by keeping an extra map during analysis. Measuring the impact would be hard. I already learned my lesson about microoptimizing this code, but others are welcome to have at it. If I have more time to work on this my priority will be:</div><div><br></div><div>- Make the Blocks lists exclusive (not quadtratic)</div><div><br></div><div>- Provide a way to check that the blocks are in RPO order, put them back in RPO order if required</div><div><br></div><div>Just having them mostly in RPO order is already a benefit though. For example, iterative dataflow converges faster but doesn't repend on the property.</div></div><div><br></div><div>-Andy</div></body></html>