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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
            Version|unknown                     |9.0

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems var-tracking, we end up with -O2 -g with main containing just debug
stmts,
  # DEBUG BEGIN_STMT
  # DEBUG thisD.212422 => NULL
  # DEBUG thisD.212423 => NULL
  # DEBUG thisD.212424 => NULL
...
  # DEBUG thisD.242421 => NULL
  # DEBUG thisD.212421 => NULL
  return 0;
for those 30000 this pointers of the ctor, and var-tracking is quite slow on
that indeed.
Though, code-generation-wise, I think that for these larger arrays we shouldn't
emit
  _1 = &this->array[0];
  MyObject::MyObject (_1);
  _2 = &this->array[1];
  MyObject::MyObject (_2);
  _3 = &this->array[2];
  MyObject::MyObject (_3);
...
  _29997 = &this->array[29996];
  MyObject::MyObject (_29997);
  _29998 = &this->array[29997];
  MyObject::MyObject (_29998);
  _29999 = &this->array[29998];
  MyObject::MyObject (_29999);
  _30000 = &this->array[29999];
  MyObject::MyObject (_30000);
but instead just a loop over the array elts initializing them, because e.g. if
everything doesn't get inlined, it will be much shorter.

Reply via email to