public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re:CSE failing for SH due to weak alias analysis
@ 2002-10-29  8:02 Erwin Ingris
  0 siblings, 0 replies; only message in thread
From: Erwin Ingris @ 2002-10-29  8:02 UTC (permalink / raw)
  To: sanjivg; +Cc: gcc

Sanjiv Kumar Gupta Wrote:
> Consider following code snippet,
> void func (double *d)
> {
>         int i = 0;
> 
>         for (i = 0; i < 20; i++)
>         {
>                 d[i+2] += d[i+1];
>                 d[i+1] += d[i];
>         }
> }
> 
> Below is the RTL dump after CSE, (with -ml -m4 -O2 
> -fno-schedule-insns2),
> '@' indicates 64-bit dereferencing here
>   ...
> 1:	r164 = r163 +16
> 2:	r172 = r163 + 8
> 3:	r173 = @r164		; loading d[i+2]
> 4:	r174 = @r172		; loading d[i+1]
> 5:	r175 = r173 + r174	; add d[i+2] and d[i+1]
> 6:	@r164 = r175		; store result into d[i+2]
> 7:	r187 = @r172		;<-- LOADING d[i+1 AGAIN !!!!! 
> 	...
> 
> line 7 need not dereference r172 again as the 
> value is already loaded in r174 by line 4. 
> The *alias analysis tells CSE that r172 and r164 
> may alias*, and CSE
> concludes that storing at r164 at line 6 invalidates
> any previous load from r172.
> But by looking at the lines 1,2 it is fairly 
> obvious that  *r172 and r164 do NOT alias*. 

Interesting !! But thats pretty bad !! There should 
be good gain if this is corrected.Probably, a chain 
of rtxs need to be maintained whereas at present
only a base reg is stored to determine whether a reg
is derived from a previous reg.

> So, this is a case of alias analysis
(true_dependence() in  alias.c) failing while
determining aliasing 
> between two pointer REGs. This affects code
> quality for SH very badly as SH does not allow 
> reg+offset addressing mode for floats.
> This problem could also be there in IA64 and 
> there might be  other variants of  the problem.
> 
> There seems to be NO existing alias code which 
> correctly  determines aliasing between two such 
> pointer REGs. base_alias_check() only checks the
base
> addresses, and memrefs_conflict_p() does NOTHING 
> for cse. 
> I am looking to improve the existing alias code so 
> that it can handle aliasing between two pointer REGs
> by looking at their history. 

http://careers.yahoo.com.au - Yahoo! Careers
- 1,000's of jobs waiting online for you!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-29  5:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-29  8:02 Re:CSE failing for SH due to weak alias analysis Erwin Ingris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).