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]

Re: code quality pesimization with function returning changes


> On Tue, Jun 05, 2001 at 05:50:44PM +0200, Jan Hubicka wrote:
> > (insn 25 23 26 (clobber (reg/i:SI 0 eax)) -1 (nil)
> >     (nil))
> > 
> > (insn 28 26 29 (set (reg/i:SI 0 eax)
> >         (reg:SI 58)) -1 (nil)
> >     (nil))
> > 
> > See the insn 28, that sets eax according to the reg 58.  The reg 58 is
> > never set, so it is live over whole function body.  This prevents
> > tail call optimization and pesimizes register allocation.
> 
> We should have reg 58 clobbered at the same time as EAX here,
> I think.  See clobber_return_register; change it to notice the
> return value in a pseudo.
I came to same conclusion during balet yesterday.
It will futher need hacking of sibcall pass.
> 
> > What exactly the patch solves?
> 
> Stuff like
> 
> 	if (p)
> 	  return a + b;
> 	else
> 	  return c + d;
> 
> can get translated as
> 
> 	(set pc (if_then_else p pc (label 1)))
> 
> 	(set (reg:SI tmp) (plus:SI a b))
> 
> 	(set (reg:DI r0) (sign_extend:DI (reg:SI tmp)))
I see, we should not have emitted the r0 directly here...

Honza


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