[LLVMdev] Upcoming Changes/Additions to Scoped-NoAlias metadata

Raul Silvera rsilvera at google.com
Fri Nov 14 15:31:24 PST 2014


>
> You don't have x1 and x2 in your example, assuming you mean:
>
>   int i = 0;
>   T A;
>   T * y2 = ...
>   {
>     T * x1 = &A;
>     a = x1[i];
>   }
>   {
>     T * restrict x2 = y2;
>     b = x2[i];
>   }
>
> then the answer is no, the fact that x2 is restrict qualified does not
> allow us to conclude that &x2[i] and &x1[i] don't alias.
>

​It should, no? by virtue of x2 being restrict you know that *x2 doesn't
alias A, and *x1 is A.​

This example is flawed anyway ​because it only has loads, so the aliasing
isn't that interesting. Something more realistic:
​
  T
​A, B

  T * x1 =
​.... // either &A or &B
  T * y2 =
​.... // ​
​maybe &A
​  ​
{
    T * restrict x2 = y2;

​*​
x
​1
​ = ...


​*​
x2
​ = ...

  }

​In this case you'll be able to tell *x1 doesn't alias​ *x2, right? How
about if you add restrict to x1?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141114/2aa558b5/attachment.html>


More information about the llvm-dev mailing list