<div dir="ltr">Hi Benoit,<div><br><br><div class="gmail_quote"><div dir="ltr">Le mer. 11 avr. 2018 à 15:25, Benoit Meister via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail-m_3843312751996249487inbox-inbox-line gmail-m_3843312751996249487inbox-inbox-number3 gmail-m_3843312751996249487inbox-inbox-index2 gmail-m_3843312751996249487inbox-inbox-alt2" style="margin:0px;padding:0px 1em 0px 0px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;border:0px;float:none;height:auto;line-height:20px;outline:0px;overflow:visible;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;background-position:0px 50%;background-repeat:initial initial">Hello, </div><div class="gmail-m_3843312751996249487inbox-inbox-line gmail-m_3843312751996249487inbox-inbox-number3 gmail-m_3843312751996249487inbox-inbox-index2 gmail-m_3843312751996249487inbox-inbox-alt2" style="margin:0px;padding:0px 1em 0px 0px;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;border:0px;float:none;height:auto;line-height:20px;outline:0px;overflow:visible;vertical-align:baseline;width:auto;box-sizing:content-box;min-height:inherit;background-position:0px 50%;background-repeat:initial initial"><br></div>I'm playing around with vectorization in LLVM 6.0.0, and I noticed that when creating a vector load out of a scalar load, the  alignment for the vector load is defined to be the one of the scalar load. For instance, 16-bit vectors get aligned on 2 bytes. This does not correspond to the preferred alignment for vectors that I specified in the data layout (which is bigger). <div><br><div>Inspecting lib/Transforms/Vectorize/LoopVectorizer.cpp, there doesn't seem to be an intent of doing so. <div>I looked at this method in particular: </div><div><br>void InnerLoopVectorizer::vectorizeMemoryInstruction</div></div></div><div><br></div><div>Is there a way (that I missed) to make this happen, or would it require a code change ? Or did I miss anything obvious ?</div></div><br></blockquote><div><br></div><div>If the original pointer before vectorization is aligned on 2 bytes boundary, the loop vectorizer can't "promote" it to the new alignment without adding checks (or code versioning) right?</div><div>Are you in a different case?</div><div><br></div><div>Also, did you see this description about the alignment in the data layout in LangRef:</div><div><br></div><div>"The function of the data layout string may not be what you expect. Notably, this is not a specification from the frontend of what alignment the code generator should use.</div><div class="gmail-section" id="gmail-data-layout"><p style="margin:0.8em 0px 0.5em">Instead, if specified, the target data layout is required to match what the ultimate <em>code generator</em> expects. This string is used by the mid-level optimizers to improve code, and this only works if it matches what the ultimate code generator uses. There is no way to generate IR that does not embed this target-specific detail into the IR. If you don’t specify the string, the default specifications will be used to generate a Data Layout and the optimization phases will operate accordingly and introduce target specificity into the IR with respect to these default specifications."</p><p style="margin:0.8em 0px 0.5em">Cheers,</p><p style="margin:0.8em 0px 0.5em">-- </p><p style="margin:0.8em 0px 0.5em">Mehdi</p><p style="margin:0.8em 0px 0.5em"> </p></div></div></div></div>