<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 8, 2020 at 7:11 AM Robinson, Paul <<a href="mailto:paul.robinson@sony.com" target="_blank">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div>
<p class="MsoNormal">When the optnone design was being discussed, Chandler specifically rejected having the pass manager involved in the decision (which was the original proposed design).  Assuming he still feels the same way now, if the existing `skipFunction`
 calls aren’t being executed under the new pass manager, then each pass that has that call will need to be modified accordingly (added to the NPM path or moved to some common point).  It would be best if the `skipFunction` calls were handled consistently in
 all passes so that it would become part of the normal pass boilerplate.</p></div></div></blockquote><div>Makes sense, thanks for the background. I'll see if there's a clean way to make this functionality easy to use in the NPM.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I suspect any `skipFunction` or opt-bisection tests have been written to force the old pass manager, which is why defaulting to the new pass manager doesn’t fail anywhere.</p></div></div></blockquote><div>I took a closer look at some optnone tests and they use opt instead of clang. opt still defaults to the legacy pass manager regardless of clang's default.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="EN-US"><div><p class="MsoNormal"><u></u><u></u></p>
<p class="MsoNormal">--paulr<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt">
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>> <b>On Behalf Of
</b>Arthur Eubanks via llvm-dev<br>
<b>Sent:</b> Sunday, June 7, 2020 7:59 PM<br>
<b>To:</b> llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b> [llvm-dev] optnone/skipping passes in the new pass manager<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Looking through some of the remaining test failures under the new pass manager, I've narrowed down one of the failures in GWPAsan(!) to the fact that the new pass manager doesn't properly skip passes like the old pass manager. For example,
 when a function is marked optnone, or when using <a href="https://llvm.org/docs/OptBisect.html" target="_blank">https://llvm.org/docs/OptBisect.html</a>.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Lots of passes (e.g. SROA) will do the following under the legacy pass manager:<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">  bool runOnFunction(Function &F) override {<br>
    if (skipFunction(F))<br>
      return false;</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">    // do pass</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Courier New"">  }</span><u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">What's the right way to proceed with this? There are 50-100 calls to skipFunction() in legacy passes. This doesn't even account for other types of IR units, like skipModule(Module&).<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I suppose it's possible to manually go in and add in the same check in the new passes, but that seems tedious (and how do you test that at scale? clearly there aren't many tests for it right now since check-llvm passes under the new pass
 manager). An alternative of skipping passes at the pass manager level would require marking each pass as necessary/optional (I think...).<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>

</blockquote></div></div>