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: order of passes (was: importing code in IR (GIMPLE and/or RTL))


> -----Original Message-----
> From: gcc-owner On Behalf Of Luchezar Belev
> Sent: 18 May 2004 15:07

> the generated code with basic block reordering enabled is:
> 
> int A(int m, int n)
> {
> 	_beginning:
> 	if (m == 0) goto _end;
> 
> 	_partial_beginning:
> 	if (n != 0) goto _common_case;
> 	m = m - 1;
> 	n = 1;
> 	if (m != 0) goto _partial_beginning;
> 
> 	_end:
> 	return n + 1;
> 
> 	_common_case:
> 	n = A(m, n - 1);
> 	m = m - 1;
> 	goto _beginning;
> }
> 
> Look at the part after the _partial_beginning label;
> n is being set to 1 (which is non-zero) and then
> if m==0 the control is directed to the now superfluous
> examination whether n==0. Instead it could go directly
> to _common_case.
> It seems that this problam is caused by the fact that
> the GSCE, which would optimize away this superfluous branch,

Sorry, don't you mean jump threading?  Is -fthread-jumps perhaps required?

> is ran before the basic block reordering, and at the moment
> when it ran, the code still looked more like the first
> case (with -fno-reorder-blocks), so it couldn't do much.

Does  -fcse-follow-jumps make any difference?

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


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