Re: Death by pointers.

preston@tera.com (Preston Briggs)
Wed, 13 Sep 1995 16:19:42 GMT

          From comp.compilers

Related articles
[2 earlier articles]
Re: Death by pointers. jhallen@world.std.com (1995-09-05)
Re: Death by pointers. whitten@netcom.com (1995-09-05)
Re: Death by pointers. chase@centerline.com (1995-09-06)
Re: Death by pointers. hbaker@netcom.com (1995-09-11)
Re: Death by pointers. graham.matthews@pell.anu.edu.au (1995-09-12)
Re: Death by pointers. chase@centerline.com (1995-09-12)
Re: Death by pointers. preston@tera.com (1995-09-13)
Re: Death by pointers. ECE@dwaf-hri.pwv.gov.za (John Carter) (1995-09-23)
Re: Death by pointers. stefan.monnier@epfl.ch (Stefan Monnier) (1995-09-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: preston@tera.com (Preston Briggs)
Keywords: C, optimize, architecture
Organization: Tera Computer Company, Seattle, WA
References: 95-08-195 95-09-030 95-09-061
Date: Wed, 13 Sep 1995 16:19:42 GMT

jhallen@world.std.com (Joseph H Allen) writes:


>Anyway, there is a solution to this problem, although I'm not sure if it's
>worthwhile. You just completely skip alias detection in the compiler.
>Assume that there is no alias to your pointer and load it into a register if
>doing so will help optimize the code. The trick is to also load an
>extension to the register with the address of the origin of the pointer.
>Now whenever the CPU does a store, it checks the address of each loaded
>pointer. If any registers have the pointer, the register gets an update.
>Basically the registers act like a sort of mini-cache.


No, this is inadequate. (However, it's been proposed so often it
ought to be in the FAQ.) Consider the following example


*p = 5;
*q = 6;
i = 5 + *p;


With adequate alias analysis, we might be able to prove that p and q
never point to the same location, allowing us to replace the addition
with the constant 10, all at compile time. Similar examples arise
with all sorts of optimization, and especially with parallelization.


Preston Briggs
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.