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: [tree-ssa] inlining now works on bnw-simple-branch


On Sun, Sep 22, 2002 at 07:23:37PM +0100, Jason Merrill wrote:
> Another possible fix would be to simplify to
> 
> if (a)
>   if (b)
>     c;
[...]
> The same alternate simplification would fix the && case, but the || case is
> more difficult.  We could simplify to something like
> 
> if (a) goto in;
> if (b)
>   {
>   in:
>     c;
>   }
> 
> or
> 
> if (a);
> else if (b);
> else goto not;
> c;
> not:
> 
> but nothing without either a goto or an extra test.

You can't handle && without a goto either.

	if (a && b)
	  c;
	else
	  d;

becomes either

	if (a)
	  if (b)
	    c;
	  else
	    goto not;
	else
	  not: d;

or

	if (a)
	  if (b)
	    {
	      c;
	      goto done;
	    }
	d;
	done:

That said, I think we _should_ generate code like this, since
it would make life easier for the global optimizers wrt 
conditional constant propagation.  Plus, if the structure of
these conditions makes it all the way to rtl, we eliminate a
branch from both paths.


r~


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