<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 4:13 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@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"><div class="gmail_quote"><span class=""><div dir="ltr">On Thu, Sep 10, 2015 at 3:26 PM Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">In `[LLVMdev] Heads up: Pass Manager changes will be starting shortly` one of the goals was "I'm going to build a bridge so that an existing Pass can be inserted into the new pass manager with some adaptors and everything will just work".<div><br></div><div>My reading of this is that there would be an incremental step where we have fully transitioned to using the new pass manager, but existing passes are using wrappers. We would then incrementally move each pass to "natively" use the new pass manager as needed (e.g. for the inliner). So I'm surprised that we are porting SROA so early.</div><div><br></div><div>Did I miss/forget something? I've noticed that in last fall's devmtg talk it looked like you have "port the existing pass pipeline" as a blocking item, so I assume there was some sort of realization in the interim. Could you elaborate on this (or point to a thread I missed?).</div></div></blockquote><div><br></div></span><div>I'm not sure which thread, but there was an update at one point where I essentially explained that I could find no clear way to have a packaged bridge that Just Worked. The cleanest solution I have found is to be able to share all the business logic, while having essentially two entry points, and to make the entry points as small and share as much code as possible. The wrappers for the legacy pass manager try to do this, but the pattern for doing it is exactly what I wanted feedback on here.</div></div></div></blockquote><div><br></div><div>Okay, makes sense.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><br></div><div>-- Sean Silva</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 10, 2015 at 2:02 PM, Chandler Carruth via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">chandlerc created this revision.<br>
chandlerc added reviewers: dexonsmith, bogner.<br>
chandlerc added a subscriber: llvm-commits.<br>
<br>
In some ways this is a very boring port to the new pass manager as there<br>
are no interesting analyses or dependencies or other oddities.<br>
<br>
However, this does introduce the first good example of a transformation<br>
pass with non-trivial state porting to the new pass manager. I've tried<br>
to carve out patterns here to replicate elsewhere, and would appreciate<br>
comments on whether folks like these patterns:<br>
<br>
- A common need in the new pass manager is to effectively lift the pass<br>
  class and some of its state into a public header file. Prior to this,<br>
  LLVM used anonymous namespaces to provide "module private" types and<br>
  utilities, but that doesn't scale to cases where a public header file<br>
  is needed and the new pass manager will exacerbate that. The pattern<br>
  I've adopted here is to use the namespace-cased-name of the core pass<br>
  (what would be a module if we had them) as a module-private namespace.<br>
  Then utility and other code can be declared and defined in this<br>
  namespace. At some point in the future, we could even have<br>
  (conditionally compiled) code that used modules features when<br>
  available to do the same basic thing.<br>
<br>
- I've split the actual pass run method in two in order to expose<br>
  a private method usable by the old pass manager to wrap the new class<br>
  with a minimum of duplicated code. I actually looked at a bunch of<br>
  ways to automate or generate these, but they are all quite terrible<br>
  IMO. The fundamental need is to extract the set of analyses which need<br>
  to cross this interface boundary, and that will end up being too<br>
  unpredictable to effectively encapsulate IMO. This is also<br>
  a relatively small amount of boiler plate that will live a relatively<br>
  short time, so I'm not too worried about the fact that it is boiler<br>
  plate.<br>
<br>
The rest of the patch is totally boring but results in a massive diff<br>
(sorry). It just moves code around and removes or adds qualifiers to<br>
reflect the new name and nesting structure.<br>
<br>
<a href="http://reviews.llvm.org/D12773" rel="noreferrer" target="_blank">http://reviews.llvm.org/D12773</a><br>
<br>
Files:<br>
  include/llvm/InitializePasses.h<br>
  include/llvm/Transforms/Scalar/SROA.h<br>
  lib/LTO/LTOCodeGenerator.cpp<br>
  lib/Transforms/Scalar/SROA.cpp<br>
  lib/Transforms/Scalar/Scalar.cpp<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>
</blockquote></div></div></div></div>
</blockquote></div><br></div></div>