<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 16px; font-family: Calibri, sans-serif;">
<div>
<div><span style="font-family: Calibri; font-size: 11pt; font-weight: bold;">From:
</span><span style="font-family: Calibri; font-size: 11pt;">Philip Reames <</span><a href="mailto:listmail@philipreames.com" style="font-family: Calibri; font-size: 11pt;">listmail@philipreames.com</a><span style="font-family: Calibri; font-size: 11pt;">></span></div>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">Date: </span>mardi 8 septembre 2015 12:50<br>
<span style="font-weight:bold">To: </span>Benoit Belley <<a href="mailto:benoit.belley@autodesk.com">benoit.belley@autodesk.com</a>>, "<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [llvm-dev] LLVM struct, alloca, SROA and the entry basic block<br>
</div>
<div><br>
</div>
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 09/08/2015 07:21 AM, Benoit Belley via llvm-dev wrote:<br>
</div>
<blockquote cite="mid:D2146725.50382%25benoit.belley@autodesk.com" type="cite">
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;
        font-size: 16px;">
Hi everyone,</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;
        font-size: 16px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;
        font-size: 16px;">
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="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;
        font-size: 16px;">
<br>
</div>
<div><i><font face="Calibri,sans-serif"><b>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">Yes.  </font><br>
</div>
</div>
</blockquote>
</span>
<div><br>
</div>
<div><br>
</div>
<div>Thanks Phil. Should this be mentioned somewhere in the documentation ? As a footnote in the LLVM Language Reference manual maybe ?</div>
<div><br>
</div>
<div>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><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF"><font face="Calibri,sans-serif"><i><b><br>
</b></i></font>
<blockquote cite="mid:D2146725.50382%25benoit.belley@autodesk.com" type="cite">
<div><i><font face="Calibri,sans-serif"><br>
</font></i></div>
<div><font face="Calibri,sans-serif">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><br>
</div>
<div>I’ll send out a test case. Maybe, that will help.</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div text="#000000" bgcolor="#FFFFFF"><br>
<blockquote cite="mid:D2146725.50382%25benoit.belley@autodesk.com" type="cite">
<div><br>
</div>
<div><b><i>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><b><i><br>
</i></b></div>
<div>Cheers,</div>
<div>Benoit<i style="font-weight: bold;"> </i></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;
        font-size: 16px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;
        font-size: 16px;">
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<b><span style="font-size: 9pt; font-family: Arial, sans-serif; color: rgb(99, 99, 99);">Benoit Belley</span></b><span style="font-size: 9pt; "><o:p></o:p></span></p>
<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);">Sr Principal Developer</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<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);">M&E-Product Development Group</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<b><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">MAIN</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> +1 514 393 1616</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<b><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">DIRECT</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> +1 438 448 6304</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<b><span style="font-size: 7pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">FAX</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"> +1 514 393 0110</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<a moz-do-not-send="true" href="http://twitter.com/autodesk" style="color: purple; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Twitter</span></a><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<a moz-do-not-send="true" href="https://www.facebook.com/Autodesk" style="color:
            purple; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Facebook</span></a><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<span style="font-size: 7.5pt; font-family: Arial, sans-serif;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<b><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">Autodesk, Inc.</span></b><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<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);">10 Duke Street</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<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);">Montreal, Quebec, Canada H3C 2L7</span><span style="font-size: 7.5pt; font-family: Arial, sans-serif;"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<a moz-do-not-send="true" href="http://www.autodesk.com/" style="color: purple; "><span style="font-size: 7.5pt; font-family: Arial, sans-serif; color: rgb(146, 147, 150);">www.autodesk.com</span></a><span style="color: rgb(146, 147, 150); "><o:p></o:p></span></p>
<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);"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt; font-size:
          11pt; ">
<img id="Picture_x0020_1" src="cid:part4.04080103.05030000@philipreames.com" alt="Description: Email_Signature_Logobar" type="image/png" height="41" width="283" border="0"><o:p></o:p></p>
<div style="font-family: Calibri; font-size: medium; ">
<p class="MsoNormal" style="margin: 0in 0in 0.0001pt;
            font-size: 11pt; font-family: Calibri, sans-serif; ">
<span style="font-size: 11.5pt; "> </span></p>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">_______________________________________________
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>
</div>
</div>
</blockquote>
</span>
</body>
</html>