This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Restrict pointers


From: Jim Wilson <wilson@specifixinc.com>

Jan Hoogerbrugge wrote:
As far as I know, memory references via two pointers where one of them is a restrict pointer and the other pointer is not restricted and is not derived from the first one are independent.

I believe the problem here is "derived from". If two pointers are both restricted, then clearly they don't alias.


If one pointer is restricted, then you have to perform tests to determine if the second pointer might be derived from the first. These tests have not been implemented yet, and may be infeasible to implement in the current alias analysis code. This is because the current code is based on RTL, and RTL is so low level that it is very hard to track pointer relationships.

It is probably more feasible to implement this in tree-ssa, where we have more info about declarations and assignments. The derived from test should be much more feasible there.

Compilers are allowed to ignore restrict, so there is no bug here. The only problem is that we have a missed optimization, because we don't have the infrastructure needed to implement the missed optimization. tree-ssa probably helps with the infrastructure problem.

It's a pitty that GCC does not exploit all power of restrict pointers. I am
working on a port of GCC to the TriMedia VLIW processor and many
of the applications that are available for this processor use restrict pointers
extensively. Many compute kernels run a few times faster when restrict
pointers are present and fully exploited. I guess that this will be true for
many other instruction-level parallel processors for which applications have
been tuned.


What can we / I do to improve the handling of restrict pointers? Any idea
of the difficulty and where to start?

Jan

_________________________________________________________________
Play online games with your friends with MSN Messenger http://messenger.msn.nl/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]