use of 'restrict' pointer

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

use of 'restrict' pointer

Arvind Sudarsanam

Hi,

 

I have C source code which qualifies some of the pointers using the ‘restrict’ keyword and used clang to generate the llvm IR code.

Here is the C source code:

 

int restrict1(void)

{

            int* restrict a;

            int* restrict b;

            int x[10];

            int y[10];

           

            *a = x[2];

            *b = x[3];

            return(x[4]);

}

 

The ‘restrict’ information seems to be lost in the generated IR code. Am I doing something wrong here?

 

Thanks

Arvind


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: use of 'restrict' pointer

Pekka Jääskeläinen
On 05/24/2010 09:12 PM, Arvind Sudarsanam wrote:
> The ‘restrict’ information seems to be lost in the generated IR code. Am
> I doing something wrong here?

I think 'restrict' works in LLVM only when the keyword is used with
function arguments. At least that was the case with LLVM 2.6.

In addition, Clang had some troubles with 'restrict' in LLVM 2.7,
but it seems to work again in Clang trunk, at least for me. See:
http://llvm.org/bugs/show_bug.cgi?id=5274

BR,
--
Pekka
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev