[Bug tree-optimization/78528] Recursion not optimized for structs

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 3 04:52:44 GMT 2021


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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
tailr1:
  D.2500 = strlen (_2);

  <bb 5> :
  lhs$m_value_10 = D.2500.m_value;
  _14 = lhs$m_value_10 + 1;
  D.2496.m_value = _14;

  <bb 6> :
  return D.2496;

For tailr on structures we only allow for structure copies and nothing else.
For an example, if we remove the + 1 part, we do get the tail recursion.  Now
the question becomes is it worth the effect in doing it.

clang can handle this case because they handle structures at a lower level than
GCC does.


More information about the Gcc-bugs mailing list