<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Igor,<br class=""><div><blockquote type="cite" class=""><div class="">On Oct 19, 2016, at 10:57 AM, Igor Laevsky <<a href="mailto:igor@azulsystems.com" class="">igor@azulsystems.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">
<blockquote type="cite" class="">
<div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Hi Igor,
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On Oct 17, 2016, at 10:39 AM, Igor Laevsky <<a href="mailto:igor@azulsystems.com" class="">igor@azulsystems.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
<blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
On Oct 14, 2016, at 9:54 AM, Igor Laevsky <<a href="mailto:igor@azulsystems.com" class="">igor@azulsystems.com</a>> wrote:<br class="">
<blockquote type="cite" class=""><br class="">
Hi Michael,<br class="">
</blockquote>
Hi Igor,<br class="">
</blockquote>
<br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">Hi
Michael,</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Hi Michael,</div>
<blockquote type="cite" class="">
<div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">
<div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">What
I was referring to is that we can write something like this inside LPPassManager iteration:</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;"> if
(getAnalaysisIfAvaliable<LCSSAVerifier>()) { CurrentLoop->verifyLCSSA(); )</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<span class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">This
will have less impact but feels a bit wrong.</span><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
</div>
</div>
</blockquote>
Originally I didn’t like this idea, but the more I think about it the more I like it. Currently all loop passes use (or should use) getLoopAnalysisUsage to record their pass requirements, so all of them should operate on the same set of analyses. What we can
do is to add a function verifyLoopAnalyses to LPM and make it call verifiers for all these analyses.</div>
<div class=""><br class="">
</div>
<div class="">So, instead of </div>
<div class="">if (getAnalaysisIfAvaliable<LCSSAVerifier>()) { CurrentLoop->verifyLCSSA(); )</div>
<div class="">we will have</div>
<div class=""> verifyLoopAnalyses(CurrentLoop);</div>
<div class="">which will do:</div>
<div class=""> CurrentLoop->verifyLCSSA();</div>
<div class=""> CurrentLoop->verifyLoopSimplify(); // For beginning we can skip everything except LCSSA</div>
<div class=""> CurrentLoop->verifySomethingElse()</div>
<div class="">
<div class=""> etc.</div>
<div class=""><br class="">
</div>
<div class="">What do you think?</div>
</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Unfortunately there are loop print passes (LoopPassPrinter and PrintLoopPassWrapper) which don’t require LCSSA. And I think it’s important to support ability to print loops without mandatory LCSSA verification. </div></div></div></div></blockquote>In this case we can leave "if(getAnalaysisIfAvaliable<LCSSAVerifier>())" as you suggested originally. However, what do we lose if we require all loop passes to require and preserve LCSSA? Why can't we just require LCSSA in the loop printers as well? We discussed that with Chandler some time ago, and there even was an idea to make it an IR property (i.e. IR would be considered invalid if LCSSA is broken) - it's still just an idea though.</div><div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class="">Probably loop printers can be converted to
function passes, but in that case we will execute them only once per LPPassManager, which is also not an option. Now I’m not sure how to better bypass this issue. Do you have any ideas?</div></div></div></div></blockquote><div><br class=""></div>Michael<br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">
<br class="">
<blockquote type="cite" class="">
<div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div class="">
<div class="">
<div class=""><br class="">
</div>
<div class="">- Michael</div>
</div>
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">
<div class=""><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<br class="">
Thanks,<br class="">
Michael<br class="">
<br class="">
<blockquote type="cite" class=""><br class="">
— Igor<br class="">
<br class="">
On 14 Oct 2016, at 01:57, Mikhail Zolotukhin <<a href="mailto:mzolotukhin@apple.com" class="">mzolotukhin@apple.com</a>> wrote:<br class="">
<br class="">
<blockquote type="cite" class="">Hi Igor,<br class="">
<br class="">
I like the second option more, and I think we can do something like this, or even more general. I'd suggest creating a new loop pass, called e.g. LoopVerification, and manually (at least for now) add it as a last pass to every instance of LPM. The pass will
directly call isRecursivelyInLCSSA for the current loop, and later probably can also check other properties like LoopSimplify This way, the verification will be executed when all loop passes have finished working with a loop and before going to another loop.
We can also schedule it in between some passes if we'd like to, and we can schedule it after all loop passes, placing it into a separate LPM instance. What do you think?<br class="">
<br class="">
For now I don't have a good idea on how to utilize PassManager to schedule such verifiers automatically though:-(<br class="">
<br class="">
- Michael<br class="">
<br class="">
PS: Did you mean to send it to the list? Chandler might have good ideas here.<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On Oct 13, 2016, at 8:30 AM, Igor Laevsky <<a href="mailto:igor@azulsystems.com" class="">igor@azulsystems.com</a>> wrote:<br class="">
<br class="">
Hi Michael,<br class="">
<br class="">
In the<span class="Apple-converted-space"> </span><a href="https://reviews.llvm.org/D25364" class="">https://reviews.llvm.org/D25364</a><span class="Apple-converted-space"> </span>we were discussing possibility of verifying LCSSA only for the top-level loops.
I started implementing this but process appears to be a bit tricky. Problem is that I can’t find a way to check that LPPassManager contains LCSSA pass without introducing circular dependency between TransformUtils and Analysis libraries. I have couple of solutions
in mind but wanted to ask your opinion on those, maybe we will be able to arrive at better decision.<br class="">
<br class="">
1. I can introduce list of loops which LCSSAWrapperPass::verifyAnalysis needs to verify. It will be stored in the LoopInfo and populated in the LPPassManager main loop. After verification LCSSAWrapperPass will remove loop from this list.<br class="">
</blockquote>
<br class="">
<blockquote type="cite" class=""><br class="">
2. There could be separate analysis “LCSSAVerification” on which LCSSA pass will depend. That way I will be able to recognise it inside LPPassManager and manually call verification of the current loop. Not sure how well our pass managers can handle such dependencies.<br class="">
<br class="">
None of those seem particularly appealing to me. What do you think? Is there any better way?<br class="">
<br class="">
Thanks,<br class="">
Igor.</blockquote>
</blockquote>
</blockquote>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div></blockquote></div><br class=""></body></html>