<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 8, 2015, at 10:11 AM, Benoit Belley via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" class="">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 16px; font-family: Calibri, sans-serif;" class="">
<div class="">
<div class=""><span style="font-family: Calibri; font-size: 11pt; font-weight: bold;" class="">From:
</span><span style="font-family: Calibri; font-size: 11pt;" class="">Philip Reames <</span><a href="mailto:listmail@philipreames.com" style="font-family: Calibri; font-size: 11pt;" class="">listmail@philipreames.com</a><span style="font-family: Calibri; font-size: 11pt;" class="">></span></div>
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<div style="font-family: Calibri; font-size: 11pt; text-align: left; border-width: 1pt medium medium; border-style: solid none none; padding: 3pt 0in 0in; border-top-color: rgb(181, 196, 223);" class="">
<span style="font-weight:bold" class="">Date: </span>mardi 8 septembre 2015 12:50<br class="">
<span style="font-weight:bold" class="">To: </span>Benoit Belley <<a href="mailto:benoit.belley@autodesk.com" class="">benoit.belley@autodesk.com</a>>, "<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>" <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>><br class="">
<span style="font-weight:bold" class="">Subject: </span>Re: [llvm-dev] LLVM struct, alloca, SROA and the entry basic block<br class="">
</div>
<div class=""><br class="">
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;" class="" type="cite">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class="">
<div class="moz-cite-prefix">On 09/08/2015 07:21 AM, Benoit Belley via llvm-dev wrote:<br class="">
</div>
<blockquote cite="mid:D2146725.50382%25benoit.belley@autodesk.com" type="cite" class="">
<div style="font-family: Calibri, sans-serif; font-size: 16px;" class="">
Hi everyone,</div>
<div style="font-family: Calibri, sans-serif; font-size: 16px;" class="">
<br class="">
</div>
<div style="font-family: Calibri, sans-serif; font-size: 16px;" class="">
We have noticed that the SROA pass will only eliminate ‘alloca’ instructions if those are located in the entry basic block of a function.</div>
<div style="font-family: Calibri, sans-serif; font-size: 16px;" class="">
<br class="">
</div>
<div class=""><i class=""><font face="Calibri,sans-serif" class=""><b class="">As a general recommendation, should the LLVM IR emitted by our compiler always place ‘alloca’ instructions in the entry basic block ? (I couldn’t find any recommendations concerning this matter.)</b></font></i></div>
</blockquote>
<font face="Calibri,sans-serif" class="">Yes.  </font><br class="">
</div>
</div>
</blockquote>
</span>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Thanks Phil. Should this be mentioned somewhere in the documentation ? As a footnote in the LLVM Language Reference manual maybe ?</div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div>This sounds like a candidate for: <a href="http://llvm.org/docs/Frontend/PerformanceTips.html" class="">http://llvm.org/docs/Frontend/PerformanceTips.html</a> ?</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 16px; font-family: Calibri, sans-serif;" class="">

<div class="">As a note, I have also find out that alloca instructions should be placed before any call instructions as these can get inlined and then, the original alloca can no longer by placed in the entry basic block!</div>
<div class=""><br class="">
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;" class="" type="cite">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class=""><font face="Calibri,sans-serif" class=""><i class=""><b class=""><br class="">
</b></i></font>
<blockquote cite="mid:D2146725.50382%25benoit.belley@autodesk.com" type="cite" class="">
<div class=""><i class=""><font face="Calibri,sans-serif" class=""><br class="">
</font></i></div>
<div class=""><font face="Calibri,sans-serif" class="">In addition, we have noticed that the MemCpy pass will attempt to copy LLVM struct using moves that are as large as possible. </font>For example, a struct of 3 floats is copied using a 64-bit and a 32-bit move. It is therefore
 important that such a struct be aligned on 8-byte boundary, not just 4 bytes! Else, one runs the risk of triggering store-forwarding failure pipelining stalls (which we did encountered really badly with one of our internal performance benchmark).</div>
</blockquote>
This sounds like a bug to me.  We shouldn't be using the large load/stores without knowing they're aligned or that unaligned access is fast on a particular target.  Where this is best fixed (memcpy, store lowering?) I don't know. 
</div>
</div>
</blockquote>
</span>
<div class=""><br class="">
</div>
<div class="">I’ll send out a test case. Maybe, that will help.</div>
<div class=""><br class="">
</div>
<span id="OLK_SRC_BODY_SECTION" class="">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;" class="" type="cite">
<div class="">
<div text="#000000" bgcolor="#FFFFFF" class=""><br class="">
<blockquote cite="mid:D2146725.50382%25benoit.belley@autodesk.com" type="cite" class="">
<div class=""><br class="">
</div>
<div class=""><b class=""><i class="">Is there any guidelines for specifying the alignment of LLVM structs allocated by alloca instructions ? Is rounding down to the structure size to the next power of 2 a good strategy ? Will the MemCpy pass issue moves of up to 64-bytes on AVX-512
 capable processors ?</i></b></div>
<div class=""><b class=""><i class=""><br class="">
</i></b></div>
<div class="">Cheers,</div>
<div class="">Benoit<i style="font-weight: bold;" class=""> </i></div>
<div style="font-family: Calibri, sans-serif; font-size: 16px;" class="">
<br class="">
</div>
<div style="font-family: Calibri, sans-serif; font-size: 16px;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<b class=""><span style="font-size: 9pt; font-family: Arial, sans-serif; color: rgb(99, 99, 99);" class="">Benoit Belley</span></b><span style="font-size: 9pt; " class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">Sr Principal Developer</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">M&E-Product Development Group</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""> </span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<b class=""><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">MAIN</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class=""> +1 514 393 1616</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<b class=""><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">DIRECT</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class=""> +1 438 448 6304</span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<b class=""><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">FAX</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class=""> +1 514 393 0110</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""> </span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<a moz-do-not-send="true" href="http://twitter.com/autodesk" style="color: purple; " class=""><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">Twitter</span></a><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<a moz-do-not-send="true" href="https://www.facebook.com/Autodesk" style="color:
            purple; " class=""><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">Facebook</span></a><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""> </span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<b class=""><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">Autodesk, Inc.</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">10 Duke Street</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">Montreal, Quebec, Canada H3C 2L7</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<a moz-do-not-send="true" href="http://www.autodesk.com/" style="color: purple; " class=""><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class="">www.autodesk.com</span></a><span style="color: rgb(146, 147, 150); " class=""><o:p class=""></o:p></span></div><p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);" class=""> </span></p><div style="margin: 0in 0in 0.0001pt; font-size: 11pt;" class="">
<span id="cid:part4.04080103.05030000@philipreames.com"><ATT00001.png></span><o:p class=""></o:p></div>
<div style="font-family: Calibri; font-size: 12px;" class=""><p class="MsoNormal" style="margin: 0in 0in 0.0001pt;
            font-size: 11pt; font-family: Calibri, sans-serif; ">
<span style="font-size: 11.5pt; " class=""> </span></p>
</div>
</div>
<br class="">
<fieldset class="mimeAttachmentHeader"></fieldset> <br class="">
<pre wrap="" class="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></pre>
</blockquote>
<br class="">
</div>
</div>
</blockquote>
</span>
</div>

<span id="cid:part4.04080103.05030000@philipreames.com"><ATT00001.png></span>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></div></body></html>