https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104639

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com

--- Comment #7 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
FWIW, thread2 does thread everything that is threadable.  That is, we thread
5->3->4 from this:

  <bb 3> [local count: 1073741824]:
  # i_1 = PHI <i_2(D)(2), 6(5)>
  if (i_1 == 4)
    goto <bb 5>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 5> [local count: 955630224]:
  goto <bb 3>; [100.00%]

into this:

  <bb 2> [local count: 118111600]:
  if (i_2(D) == 4)
    goto <bb 3>; [97.00%]
  else
    goto <bb 4>; [3.00%]

  <bb 3> [local count: 955630224]:
  # i_5 = PHI <6(2)>

  <bb 4> [local count: 118111600]:
  # i_6 = PHI <i_2(D)(2), i_5(3)>
  _3 = i_6 != 0;
  return _3;

There are no more conditionals we can thread in the final form above.

To my untrained eye, it does seem like phiopt should be able to optimize:

  <bb 4> [local count: 118111600]:
  # i_6 = PHI <i_2(D)(2), 6(3)>
  _3 = i_6 != 0;

into:

  _3 = i_2 != 0;

Then BB2 and BB3 can just be cleaned up as dead?

Reply via email to