<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 15, 2014 at 5:41 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><br>
On 2014-Apr-15, at 3:41, Jera Hensel <<a href="mailto:jera.hensel@gmail.com">jera.hensel@gmail.com</a>> wrote:<br>
<br>
> - Do alignments provide additional semantics to be obeyed by the compiler or are they just hints that can be ignored?<br>
<br>
</div>Depends on where the alignment is used.  For stores [1] it's a hint, as<br>
John and Tim said.  For global variables [2] it's an additional semantic.<br>
<br>
[1]: <a href="http://llvm.org/docs/LangRef.html#store-instruction" target="_blank">http://llvm.org/docs/LangRef.html#store-instruction</a><br>
[2]: <a href="http://llvm.org/docs/LangRef.html#global-variables" target="_blank">http://llvm.org/docs/LangRef.html#global-variables</a></blockquote><div><br></div><div>'align' on stores is not a hint: "Overestimating the alignment results in undefined behavior."</div>
<div><br></div><div>Unaligned stores can trap on some ISAs (not many that matter), but I believe we also try to use this information to optimize %b to zero here:</div><div>store i32* %p, i32 0, align 4</div><div>%i = ptrtoint i32* %p to i64</div>
<div>%b = and i64 %i, i64 3</div></div></div></div>