[LLVMdev] Pointer aliasing issue

Artiom Myaskouvskey artiomka at gmail.com
Mon Oct 11 04:19:26 PDT 2010


Unfortunately since in this example function arguments are array of
pointers, __restrict doesn't help.
Yes, using 2 stores into same location is intentional.

On Mon, Oct 11, 2010 at 12:20 PM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Artiom,
>
> > I have following C code:
> >
> >     void factorial(float **a, float **b)
> >     {
> >        b[2][2] = a[0][2];
> >        b[2][2] = a[0][1];
> >     }
> ...
> > Assuming that a and b arrays contains pointers that are not aliased,
> > is it possible to remove the first store by using some C or LLVM IR
> specific
> > declarations?
>
> try this:
>
> void factorial(float ** __restrict a, float ** __restrict b)
> {
>   b[2][2] = a[0][2];
>   b[2][2] = a[0][1];
> }
>
> Ciao,
>
> Duncan.
>
> PS: Did you mean to use b[2][2] in both lines?
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



-- 
Artiom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101011/f3ded47a/attachment.html>


More information about the llvm-dev mailing list