<div dir="ltr">ok, Scalar.h  will eventually be deprecated then.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 10:34 AM, 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">chandlerc added inline comments.<br>
<span class=""><br>
================<br>
Comment at: llvm/trunk/lib/Target/NVPTX/NVPTXTargetMachine.cpp:47<br>
@@ -46,2 +46,3 @@<br>
 #include "llvm/Transforms/Scalar.h"<br>
+#include "llvm/Transforms/Scalar/GVN.h"<br>
<br>
----------------<br>
</span><span class="">davidxl wrote:<br>
> chandlerc wrote:<br>
> > davidxl wrote:<br>
> > > I noticed this line -- why is this inclusion needed?<br>
> > Because NVPTX adds GVN into its target-specific code generation pass pipeline, and so it needs the 'createGVNPass' function. (You should be able to delete this and see the compile fail. At least, that's how I knew to add it.)<br>
> The question is why Scalar .h does not include GVN.h?<br>
</span>Historically, LLVM used monolithic headers and functions that returned opaque types for passes.<br>
<br>
A large chunk of the new pass manager design moves us towards "normal" patterns. There is a header, with a type, and maybe some helper functions. It allows much more fine grained headers so folks only pull in what they need. And with new-style passes it allows passes to be used outside the context of a pass manager if desirable (for unit testing for example).<br>
<br>
If Scalar.h included GVN.h, then it would pull in a pretty large pile of code that doesn't make sense for everyone to pull in.<br>
<br>
If Scalar.h continued to own the createGVNPass function, it would break proper modularity, as the constructs being defined in GVN.cpp would be declared in different and fairly distant places.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D18019" rel="noreferrer" target="_blank">http://reviews.llvm.org/D18019</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div>