<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 12, 2015 at 8:02 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Jan 12, 2015 at 5:44 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@gmail.com" target="_blank"><span class="il">chandlerc</span>@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: <span class="il">chandlerc</span><br>
Date: Mon Jan 12 19:44:56 2015<br>
New Revision: 225750<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=225750&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=225750&view=rev</a><br>
Log:<br>
[PM] Fix another place where I was using an overly generic T&& for the<br>
IR unit to directly use IRUnitT& for now.<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/IR/PassManager.h<br>
<br>
Modified: llvm/trunk/include/llvm/IR/PassManager.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=225750&r1=225749&r2=225750&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=225750&r1=225749&r2=225750&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/IR/PassManager.h (original)<br>
+++ llvm/trunk/include/llvm/IR/PassManager.h Mon Jan 12 19:44:56 2015<br>
@@ -828,7 +828,7 @@ template <typename AnalysisT> struct Inv<br>
 /// analysis passes to be re-run to produce fresh results if any are needed.<br>
 struct InvalidateAllAnalysesPass {<br>
   /// \brief Run this pass over some unit of IR.<br>
-  template <typename T> PreservedAnalyses run(T &&Arg) {<br>
+  template <typename IRUnitT> PreservedAnalyses run(IRUnitT &Arg) {<br></blockquote></span><div><br>Since this isn't a virtual function you're implementing, you could add 'const' here without breaking any contracts (it's compatible with callers passing non-const, but helps (only slightly) indicate that this isn't modifying.<br></div></blockquote><div><br></div><div>I would much prefer that this remain consistent with the signature of every other analysis.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>Arguably, I would imagine, all Analyses should take a const ref to the IRUnit?</div></blockquote></div><br>Arguably. However, IR isn't terribly const-correct currently. The most egregious example of this that jumps to mind is that you can't create a ValueHandle around a const Value. I think this is an API bug as doing this doesn't change the observable properties of the Value, but I'm not really prepared to fix *all* of the non-const APIs that have evolved as a consequence of that API bug. =/ At some point, it would be nice to try to work bottom up and const-correct the API so that const served as a useful guard for what an analysis should and shouldn't be doing to the IR it accesses, it's just a *lot* of work and the pass manager stuff is enough as it stands. At least, that's currently where I've come down on the APIs. =/ Not at all ideal though.</div></div>