<div dir="ltr"><div>Hi Vedant,<br><br></div>Thanks for your reply. More comments inline.<br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Son Tuan Vu</div></div></div>
<br><div class="gmail_quote">On Fri, Apr 20, 2018 at 10:19 PM, Vedant Kumar <span dir="ltr"><<a href="mailto:vsk@apple.com" target="_blank">vsk@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div>Hi,</div><div><br></div><div>+ Chandler, who has a lot more experience with our pass managers.</div><div><span class=""><br><blockquote type="cite"><div>On Apr 20, 2018, at 12:56 PM, Son Tuan VU <<a href="mailto:sontuan.vu119@gmail.com" target="_blank">sontuan.vu119@gmail.com</a>> wrote:</div><br class="m_-7496564123560258389Apple-interchange-newline"><div><div dir="ltr">+ Vedant: what do you think about the last point, since Debugify is also related?<br></div></div></blockquote><div><br></div></span><div>Could you clarify the question? I'm not sure what it is you'd like me to chime in about.</div><div><br></div></div></div></blockquote><div>I guess you now know what I wanted to ask? <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div></div><div><br></div><div><span class=""><div></div><blockquote type="cite"><div>2, I've asked this question once but have had no answer, so I'm gonna revive it here: in <b>opt</b>, the <b>verify-each</b> mode is only activated when we provide a pass name or a pipeline (list of pass names).  I guess this is intended, but I expect that <b>verify-each</b> to insert <b>Verifier</b> to the whole pipeline after each optimization pass, even when I pass -O1/2/3/s/z to <b>opt</b>.  And I assume others do expect the same thing.</div></blockquote><div><br></div></span><div>I'd expect the same thing. I'm pretty sure it's a missing feature that -verify-each doesn't apply at opt -O1/etc.</div><span class=""><div><br></div><br><blockquote type="cite"><div>The 2nd question lead me to another idea: if we really want to make <b>verify-each</b> to work on any pipeline (not only user-provided ones), and we'll soon have a <b>debugify-each</b> option, should we refactor the code to have a <b>apply-after-each=pass-name</b> <wbr>option that automatically inserts <b>pass-name </b>to the pipeline after each optimization pass?  We can even replace <b>print-after-all</b> option with <b>apply-after-each=<wbr>PrintModulePassWrapper </b>for example?</div></blockquote><br></span></div><div>Speaking for myself, I'd rather type "opt -foo-each" over "opt -apply-after-each=foo".</div></div></div></blockquote><div><br></div><div>I agree that "opt -foo-each" would be easier and more intuitive, but if someone ever wants to apply foo after each pass, she will have to hack into opt and write her own custom PassManager. Or maybe this situation is not likely to happen?  <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><div><br></div><div>best,</div><div>vedant</div><span class=""><div><br></div><br><blockquote type="cite"><div><div dir="ltr"><div><div class="gmail_extra"><br clear="all"><div><div class="m_-7496564123560258389m_-4988062535238603916gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Son Tuan Vu</div></div></div>
<br><div class="gmail_quote">On Thu, Apr 19, 2018 at 6:14 PM, Philip Pfaffe <span dir="ltr"><<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Son,<div><br></div><div>PassManagerBuilder is used to populate legacy PassManagers.  That role is taken over by PassBuilder for new-PM passes.</div><div><br></div><div>Cheers,</div><div>Philip</div></div><div class="m_-7496564123560258389m_-4988062535238603916HOEnZb"><div class="m_-7496564123560258389m_-4988062535238603916h5"><div class="gmail_extra"><br><div class="gmail_quote">2018-04-18 13:40 GMT+02:00 Son Tuan VU <span dir="ltr"><<a href="mailto:sontuan.vu119@gmail.com" target="_blank">sontuan.vu119@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Philip,<div><br></div><div>Thank you for your reply. So what would be the right way/API to write out-of-tree pass? I've been using <b>PassManagerBuilder</b>, which requires a callback refering to <b>legacy::PassManagerBase</b>, so I guess this will be no longer the good way to go?</div></div><div class="gmail_extra"><span class="m_-7496564123560258389m_-4988062535238603916m_2100459851225606617HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_-7496564123560258389m_-4988062535238603916m_2100459851225606617m_-4342999132220212639gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Son Tuan Vu</div></div></div></font></span><div><div class="m_-7496564123560258389m_-4988062535238603916m_2100459851225606617h5">
<br><div class="gmail_quote">On Tue, Apr 17, 2018 at 6:06 PM, Philip Pfaffe <span dir="ltr"><<a href="mailto:philip.pfaffe@gmail.com" target="_blank">philip.pfaffe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Son,<div><br></div><div>I have an answer to your first question:<br><div><br><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>1, What are the differences between <b>LegacyPassManager</b> and <b>PassManager</b>?  I see that <b>opt</b> uses the former most of the times while the latter is used via <b>PassBuilder</b> API when an user wants to build her own pipeline, but I have no idea why so. What to use and when to use it is not clear to me.</div></div></blockquote></span><div>PassManager is the result of a long going effort to replace the default pass manager of opt and clang. Here's the original RFC containing the motivation: <a href="http://lists.llvm.org/pipermail/llvm-dev/2012-July/051643.html" target="_blank">http://lists.llvm.org/pipermai<wbr>l/llvm-dev/2012-July/051643.ht<wbr>ml</a></div><div><br></div><div>LegacyPassManager is currently still the default, but we are really close to switching over the the new one. Both opt and clang have switches to enable the new one, by calling `opt -passes="...."` or `clang -fexperimental-new-pass-manage<wbr>r`. PassBuilder is essentially a big factory to produce PassManager and AnalysisManager objects for the passes and analyses included in core LLVM. If you develop analyses and passes, I'd suggest doing so against the new PM, especially if you plan on upstreaming your work.</div><div><br></div><div>Cheers,</div><div>Philip</div></div></div></div></div></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div></div>