------- Comment #15 from jakub at gcc dot gnu dot org  2007-11-12 19:11 -------
Sorry for the delay.

Unfortunately that doesn't help in this case:
on foo from #c7 it is not cselim pass, but lim, which changes:
foo (x, y)
{
  int i;

<bb 2>:

<bb 3>:
  # i_12 = PHI <i_5(6), 0(2)>
  if (x_3(D) < i_12)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  v = y_4(D);

<bb 5>:
  i_5 = i_12 + 1;
  if (i_5 <= 99)
    goto <bb 6>;
  else
    goto <bb 7>;

<bb 6>:
  goto <bb 3>;

<bb 7>:
  return;

}

into:

foo (x, y)
{
  int v_lsm.12;
  int i;

<bb 2>:
  v_lsm.12_11 = v;

<bb 3>:
  # v_lsm.12_1 = PHI <v_lsm.12_7(6), v_lsm.12_11(2)>
  # i_12 = PHI <i_5(6), 0(2)>
  if (x_3(D) < i_12)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  v_lsm.12_10 = y_4(D);

<bb 5>:
  # v_lsm.12_7 = PHI <v_lsm.12_1(3), v_lsm.12_10(4)>
  i_5 = i_12 + 1;
  if (i_5 <= 99)
    goto <bb 6>;
  else
    goto <bb 7>;

<bb 6>:
  goto <bb 3>;

<bb 7>:
  # v_lsm.12_15 = PHI <v_lsm.12_7(5)>
  v = v_lsm.12_15;
  return;

}

which is unsafe, as there is no guarantee v is ever written within the loop.


-- 


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

Reply via email to