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

--- Comment #14 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
One interesting situation is:
void std::vector<std::pair<unsigned int, unsigned int> >::push_back (struct
vector * const this, const struct value_type & __x)
{
  struct __normal_iterator D.27894;
  struct pair * _1;
  struct pair * _2;
  struct pair * _3;

  <bb 2> [local count: 1073741824]:
  _1 = this_6(D)->D.26707._M_impl.D.26014._M_finish;
  _2 = this_6(D)->D.26707._M_impl.D.26014._M_end_of_storage;
  if (_1 != _2)
    goto <bb 3>; [82.57%]
  else
    goto <bb 4>; [17.43%]

  <bb 3> [local count: 886588625]:
  *_1 = MEM[(const struct pair &)__x_7(D)];
  _3 = _1 + 8;
  this_6(D)->D.26707._M_impl.D.26014._M_finish = _3;
  goto <bb 5>; [100.00%]

  <bb 4> [local count: 187153200]:
  D.27894._M_current = _1;
  std::vector<std::pair<unsigned int, unsigned int> >::_M_realloc_insert<const
std::pair<unsigned int, unsigned int>&> (this_6(D), D.27894, __x_7(D));

  <bb 5> [local count: 1073741824]:
  return;

}
here we could do partial inlining and offline the call to _M_realloc_insert but
we fail to cut since _1 is already load:

Split point at BB 4
  header time: 9.302800 header size: 9
  split time: 2.440200 split size: 5
  bbs: 4
  SSA names to pass: 1, 9, 11
  Refused: need to pass non-param values 

It should be easy to insert code loading the parameter again in the split part.
We still hit the SRA limitation since this would be still escaping, but it is
another missed optimization on this simple testcase.

Reply via email to