[llvm-commits] [Patch] Teach basic alias analysis about inline asm "memory" clobber

Jim Grosbach grosbach at apple.com
Wed Mar 28 10:58:57 PDT 2012

On Mar 28, 2012, at 9:52 AM, Richard Osborne <richard at xmos.com> wrote:

> My understanding is that with gcc inline asm the "memory" clobber should be specified whenever an asm statement may access memory that isn't accessible via one of its operands.
> For example with the following code:
> int x;
> int foo()
> {
>  int y;
>  x = 1;
>  asm("");
>  x = 2;
> }
> gcc 4.4.3 optimizes away the first store to x. This optimization is disabled if "memory" is listed as one of the clobbers. This patch teaches basic alias analysis that calls to inline asm without the "memory" clobber only access their argument pointers.

My understanding is that "memory" alone still is restricted to memory that's one of the operands and says that the location can be modified in an "unpredictable way." For memory not listed as an operand, "volatile" must also be specified.


More information about the llvm-commits mailing list