no noalias not negligible

Richard A. O'Keefe ok at quintus.UUCP
Wed May 25 12:55:44 AEST 1988


In article <221 at chem.ucsd.EDU>, tps at chem.ucsd.edu (Tom Stockfisch) writes:
> Given the awkwardness and limitations of #pragma directives, I think the
> best course for vectorizing compiler writers is to experiment with their
> own ideas of what noalias (and perhaps some other mechanism as well) should
> mean.  People can always port code written using noalias by compiling with
> "cc -Dnoalias="

#pragma is pretty open-ended, so I don't see why it should be awkward.
Apart from the "no change to the meaning of the program" bit which might
as well be thrown away, #pragma seems to me a much better means than
something like noalias.

Why?  Well, let's take the daxpy() example.  The property the compiler
needs is NOT that dx has no aliases or that dy has no aliases, but that
dx and dy do not overlap.  More generally a declaration
	#pragma disjoint(x, ..., z)
might tell a compiler "assume that anything accessed via 'x' is
distinct from anything accessed via ..., 'z'" and so on.

I might well have a program with four pointers
	p, q, r, s
where	#pragma disjoint(p, q)	/* or _disjoint (p,q), (r,s); */
	#pragma disjoint(r, s)	/* or whatever */
but p and r might be potentially aliased and so might q and s.
That shouldn't inhibit optimisation in regions where only p and q
appear or where only r and s appear.

This is not a proposal for a replacement for 'noalias'.  I merely point
out that since aliasing is a property of _sets_ of variables, trying to
hack it with declarations about _single_ variables doesn't seem like a
good approach.



More information about the Comp.lang.c mailing list