<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Apr 18, 2016 at 2:28 PM Xinliang David Li <<a href="mailto:davidxl@google.com">davidxl@google.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"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 18, 2016 at 2:18 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">The difference between Analysis and Transforms is *not* about passes, but about what the code *does*.<div><br></div><div>Code for mutating the IR should be in Transforms, and code that analyzes the IR without mutating it should be in Analysis. This is why, for example, InstructionSimplify is in Analysis -- it does not mutate the IR in any way.</div><div><br></div><div>So I think InlineCost and similar things should stay in the Analysis library regardless of whether they are passes or not.</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Is that the only criteria (IR mod or not) ?</div></div></div></div></blockquote><div><br></div><div>Given a public API, yes, that should be the only criteria IMO.</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_extra"><div class="gmail_quote"><div> Most of the transformations have pass specific analysis (that are not shared with other clients) -- those code stay with the transformation -- it does not make sense to move those code in to Analysis.</div></div></div></div></blockquote><div><br></div><div>But I would expect these to also not expose public APIs to the analyses. Provided the public API is limited to the transformation, I think the code be closely located makes sense.</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_extra"><div class="gmail_quote"><div>  For the same reason, we need to ask first if InlineCost is intended to be a shared utility?</div></div></div></div></blockquote><div><br></div><div>Sure, but in fact at least some parts of it are shared.</div><div><br></div><div>There is also some reason to prefer surfacing nice high-level public APIs when reasonable to do so. For example, if someone wanted to write a custom inlining pass that re-used the cost analysis, having it separated seems useful. So unless there is a significant problem solved by sinking this to be a private API only used by the inliner, I would keep it as-is.</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_extra"><div class="gmail_quote"><div><br></div><div>David</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></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><div><div><br><div class="gmail_quote"><div dir="ltr">On Mon, Apr 18, 2016 at 2:14 PM Mehdi Amini via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On Apr 18, 2016, at 2:07 PM, Hal Finkel via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> ----- Original Message -----<br>
>> From: "Easwaran Raman" <<a href="mailto:eraman@google.com" target="_blank">eraman@google.com</a>><br>
>> To: "via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
>> Cc: "Chandler Carruth" <<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>>, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>>, "Philip Reames"<br>
>> <<a href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>>, "David Li" <<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>><br>
>> Sent: Monday, April 18, 2016 2:39:49 PM<br>
>> Subject: Move InlineCost.cpp out of Analysis?<br>
>><br>
>><br>
>> Hi,<br>
>><br>
>><br>
>> After r256521 - which removes InlineCostAnalysis class - I think<br>
>> there is no strong reason for InlineCost.cpp to be part of the<br>
>> Analysis library. Is it fine to make it part of TransformUtils?<br>
>><br>
><br>
> Given that InlineCost is not really an analysis any longer, I think this is fine.<br>
<br>
Isn't it? It is not a pass, but I see it as an analysis utils.<br>
<br>
><br>
>><br>
>> I submitted r266477 (which has now been reverted) that made Analysis<br>
>> depend on ProfileData in order to obtain ProfileSummary for the<br>
>> module, but there is an existing dependency of ProfileData on<br>
>> Analysis (through Object and BitCode).<br>
<br>
The real issue is that BitCode depends on Analysis I think.<br>
I'm not sure about ProfileData that depends on Bitcode, do you know why?<br>
<br>
--<br>
Mehdi<br>
<br>
<br>
>> Moving InlineCost.cpp under<br>
>> Transforms/Utils will fix this issue. There are other ways to fix<br>
>> this (make Inliner.cpp get the ProfileSummary and pass it to<br>
>> InlineCost, for example), but I think it makes sense to move<br>
>> InlineCost.<br>
>><br>
>><br>
>> Thoughts?<br>
>><br>
>><br>
>> Thanks,<br>
>> Easwaran<br>
>><br>
>><br>
><br>
> --<br>
> Hal Finkel<br>
> Assistant Computational Scientist<br>
> Leadership Computing Facility<br>
> Argonne National Laboratory<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div></div></div></div>
</blockquote></div></div></div></blockquote></div></div>