http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14799

Tom de Vries <tom at codesourcery dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tom at codesourcery dot com

--- Comment #3 from Tom de Vries <tom at codesourcery dot com> 2011-01-14 
15:45:56 UTC ---
The example from the description field looks like this at tree level (optimized
dump with 4.5.1). It takes until late in the rtl untill the duplicate call
blocks are collapsed.
...
foo (int a)
{
<bb 2>:
  if (a_1(D) == 30)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  bar (); [tail call]
  goto <bb 10>;

<bb 4>:
  if (a_1(D) == 31)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  bar (); [tail call]
  goto <bb 10>;

<bb 6>:
  if (a_1(D) == 53)
    goto <bb 7>;
  else
    goto <bb 8>;

<bb 7>:
  bar (); [tail call]
  goto <bb 10>;

<bb 8>:
  if (a_1(D) == 23)
    goto <bb 9>;
  else
    goto <bb 10>;

<bb 9>:
  bar (); [tail call]

<bb 10>:
  return;
}
...

If the duplicate blocks would have been collapsed, it would look like this:
...
foo (int a)
{
<bb 2>:
  if (a_1(D) == 30)
    goto <bb 9>;
  else
    goto <bb 4>;

<bb 4>:
  if (a_1(D) == 31)
    goto <bb 9>;
  else
    goto <bb 6>;

<bb 6>:
  if (a_1(D) == 53)
    goto <bb 9>;
  else
    goto <bb 8>;

<bb 8>:
  if (a_1(D) == 23)
    goto <bb 9>;
  else
    goto <bb 10>;

<bb 9>:
  bar (); [tail call]

<bb 10>:
  return;
}
...
for this representation, the patch from PR 46935 comment 5 should work.

Reply via email to