[llvm-dev] Alignment of the StoreInst

Hongbin Zheng via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 16 12:22:19 PST 2016


Hi Tim,

Thanks for the explanation. The above code snippets is actually extracted
by bugpoint from
MultiSource/Applications/ALAC/encode/alacconvert-encode.test.
I get a different result if I cast the pointer to int and mask away the
lower two bits and cast the int back to pointer. While casting pointer to
int and back to pointer do not cause any problem.

Thanks
Hongbin

On Fri, Dec 16, 2016 at 12:14 PM, Tim Northover <t.p.northover at gmail.com>
wrote:

> Hi Hongbin,
>
> On 16 December 2016 at 11:57, Hongbin Zheng via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > We have an "align 4" in the StoreInst. Does this mean
> > 1) the address 'A' should be aligned to 4 bytes?
> > 2) the lower 2 bits of 'A' should be always 0?
>
> Yes, these are both the same. It means the compiler will assume those
> facts when reasoning about what that store might do and possibly when
> choosing what instruction to use to implement it.
>
> Chers.
>
> Tim.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161216/9a6e71af/attachment.html>


More information about the llvm-dev mailing list