This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Implementing "restrict", and other alias questions
- To: John Carr <jfc at tiac dot net>
- Subject: Re: Implementing "restrict", and other alias questions
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Sun, 28 Dec 97 15:29:47 +0100
- Cc: egcs at cygnus dot com
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <9712281018.AA28079@moene.indiv.nluug.nl>
> 5. Are there any important missing aliasing optimizations
> in Fortran?
The basic rule in Fortran is: If you don't *tell* the compiler
there's overlap then it can assume there isn't. The only way to
tell the compiler about overlapping storage is via EQUIVALENCE.
So your question boils down to:
1. Does your alias analysis detect all forms of overlap due to the
use of the EQUIVALENCE construct, e.g.:
SUBROUTINE AAP
DIMENSION WIM(100), ZUS(100)
EQUIVALENCE (WIM(10), ZUS(20))
[ initialisation of ZUS ]
DO I = 1, 91
WIM(I) = ZUS(I+9) + 10.0
ENDDO
END
2. Two different local arrays cannot overlap (unless by EQUIVALENCE,
like above). Two different arrays in COMMON cannot overlap at all.
Does your alias analysis detect those cases ?
> (Moving stores out of loops doesn't count -- this is a
> loop optimizer deficiency.)
For those who don't know the context of this remark - I came across
this deficiency while looking for code on which John's alias
analysis would be a win, so naturally I thought that the inability
of g77 to move stores to loop-constant addresses out of the loop was
related to alias analysis - however, John pointed out to me that
the current loop optimisation pass doesn't do this at all.
Toon.