[PATCH] PR29145 - be more restrict about restrict qualifier

Dorit Nuzman DORIT@il.ibm.com
Tue Jan 9 09:32:00 GMT 2007


This patch avoids generating wrong code by making us more conservative in
our interpretation of the restrict qualifier. It makes us conclude that two
pointers don't overlap only if both are "based on" restricted pointers,
with "based on" trivially implemented as the pointer used in the reference
itself. In addition, we check that the declarations of both pointers are in
the parameter list of the same function (to be safe w.r.t the scope of the
pointer declarations).

It's a stronger requirement than the definition of restrict, but if most
uses of restrict are with pointers passed as arguments to a function (which
I don't know to be the case) then this patch would be good enough. Most of
the vectorizer testcases use restrict in that way, and continue to get
vectorized with this patch. Two testcases that don't, however, are -
vect-[74,80].c, for which we need a bit less trivial implementation of
"based on".

Improvements on this would be to make us less conservative (at least enough
to be able to vectorizer vect-[74,80].c again), and better - have this
handled by the alias analyzer rather than this code in tree-data-ref.c.

Bootstrapped and tested on powerpc-linux.
:ADDPATCH (tree-ssa,aliasing):

ok for mainline?

thanks,
dorit

ChangeLog:

        PR tree-optimization/29145
        * tree-data-ref.c (base_addr_differ_p): Make us more conservative
        in our handling of restrict qualified pointers.

Testsuite ChangeLog:

        PR tree-optimization/29145
        * gcc.dg/vect/vect-74.c: Xfail the test - cannot be vectorized
until
        alias analysis is improved to take better advantage of restrict
        qualified pointers.
        * gcc.dg/vect/vect-80.c: Likewise.
        * gcc.dg/vect/pr29145.c: New.

(See attached file: restrict.patch.txt)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: restrict.patch.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070109/641d3669/attachment.txt>


More information about the Gcc-patches mailing list