<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 27, 2019 at 9:24 AM Priyanka Bose via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</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 dir="ltr"><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif">Hi,</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif">We are using clang based compiler for our android
build system.</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif">We plan to enable the PGO (profile guided optimization
) for some of our android modules</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif">I would like to have some understanding on the way
that the PGO profiles are being used by the clang compiler.</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">As I understand Profile guidance enables the
compiler to make better optimization decisions by using knowledge about how the
program actually runs. </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">With this profile information, the compiler can
do a better job of inlining functions, ordering basic blocks, allocating
registers, and so on</span>.</p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">So I would like to know if the clang based
compiler in android will use these profiles for making better decisions on
inlining or register allocations ?</span></p></div></blockquote><div><br></div><div>Not sure on the register allocation, but definitely yes for inlining. It is also used for a slew of other optimizations (e.g. value profiling based indirect call promotion and memcpy optimization, partial inlining, function layout, and misc other places.</div><div><br></div><div>Teresa</div><div><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 dir="ltr"><p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">But when I went through the clang documentation,
right now the pgo profiles can be used for block reordering but could not find
reference as to whether it helps the compiler </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">to take any other optimized decision .</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><a href="https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization" style="color:rgb(5,99,193)" target="_blank">https://clang.llvm.org/docs/UsersManual.html#profile-guided-optimization</a><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)"></span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">Can you please help me to get this information
if it’s something that clang has yet to support with regards to PGO generated
profiles.</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)"> </span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">Best Regards</span></p>

<p class="MsoNormal" style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:10pt;font-family:Arial,sans-serif;color:black;background:rgb(249,250,252)">Priyanka</span><span lang="EN-IN" style="font-size:10pt;font-family:Arial,sans-serif"></span></p></div>
_______________________________________________<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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"><br></td></tr></tbody></table></span></div></div></div></div>