This is the mail archive of the gcc-patches@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] tree-cfg.c cleanups/fixes when removing blocks with reachable children


Hello,

> This code will likely go away once Zdenek's work on killing our container
> based IL is complete.  However until then this is a significant improvement
> over the existing code.
> 
> The fundamental problem is the existing code relied on the badly implemented
> find_subblocks to determine what blocks were sub-blocks of a nested control
> statement.  find_subblocks merely started at the control statement's block
> and iterated forward through the basic blocks checking to see if the
> parent was unchanged.  I won't go into all the details, but it should be
> sufficient to say this failed in numerous ways -- sometimes claiming too
> many blocks where subblocks, sometimes claiming too few blocks were subblocks.
> 
> My jump threading through conditional branches change creates code with
> less structure and more throughly exercises the code to deal with
> unreachable control structures with reachable children.  It became pretty
> clear that find_subblocks as it was implemented was unfixable.  Luckily
> I had written find_contained_blocks to support EH, which does the same thing,
> but actually gets it right :-)

does it fix the following testcase?  If not, could it be possible to
persuade it to do it?

A similar code is produced by my (not yet posted, but almost ready)
patch to eliminate LOOP_EXPRs for one testcase in testsuite, so it
would help me not to introduce this regression with it.

Zdenek

void foo(void)
{
  if (1)
    {
      goto bla;
    }
  else
    {
xxx:
	{
bla:
	  bar ();
	  return;
	}
      goto xxx;
    }
}


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