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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, we have
  <bb 2> [local count: 118111600]:
  if (c_5(D) != 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

  <bb 3> [local count: 59055800]:

  <bb 4> [local count: 118111600]:
  # x_2 = PHI <b_6(D)(2), 7(3)>
  if (n_7(D) != 0)
    goto <bb 5>; [89.00%]
  else
    goto <bb 6>; [11.00%]

  <bb 5> [local count: 955630224]:
  # i_15 = PHI <i_11(5), 0(4)>
  _1 = (unsigned _BitInt(135)) i_15;
  y_10 = _1 + x_2;
  i_11 = i_15 + 1;
  if (n_7(D) > i_11)
    goto <bb 5>; [89.00%]
  else
    goto <bb 6>; [11.00%]

  <bb 6> [local count: 118111600]:
  # y_14 = PHI <y_10(5), b_6(D)(4)>
  <retval> = y_14;
  return <retval>;
and bitintlower1 coalescing decides to put x_2 into bitint.5 (i.e. a temporary)
and b_6(D), y_10 and y_14 being coalesced into b (so far so good).
I think the bug is that in the loop above we emit
  bitint.5 ={v} {CLOBBER(eos)};
after lowered y_10 = _1 + x_2; addition.

The condition whether to emit the clobber after the stmt is:
      if (m_first
          && m_single_use_names
          && m_vars[p] != m_lhs
          && m_after_stmt
          && bitmap_bit_p (m_single_use_names, SSA_NAME_VERSION (op)))
with the idea that if some SSA_NAME is used just once, we don't need anything
in its underlying variable after we've used it.
This testcase proves that the condition for it is insufficient, even when it is
used just once, if the definition dominates a loop with the use, then we can't
clobber it either.  Now unsure what is the best condition, easiest would be to
only do this if the SSA_NAME_DEF_STMT and use are inside of the  same bb, or
ebb.  Dunno if we can reliably  check if loop father of the def stmt and use bb
is the same and otherwise punt.

Reply via email to