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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-09-06
                 CC|                            |law at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org
          Component|c++                         |tree-optimization
            Summary|Missed dead store           |Missed dead store
                   |elimination when returning  |elimination of aggregate
                   |constexpr generated data    |store followed by partial
                   |                            |stores
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think we have a duplicate for this somewhere -- our DSE cannot handle the
situation where a larger store is made dead by several following smaller ones.
We have

auto foo() ()
{
  <bb 2>:
  <retval> = {};
  <retval>.buf[0] = 48;
  <retval>.buf[1] = 32;
  <retval>.buf[2] = 49;
  <retval>.buf[3] = 32;
...
  <retval>.buf[29] = 49;
  <retval>.buf[30] = 51;
  return <retval>;

}

here.  I believe Jeff had some patches in this area (that I didn't like too
much)
that would maybe have handled this special case.

Note that integrating (some) "DSE" into SRA could allow to handle the case of
a single byte not being written twice and thus decompose the large initializer.

Note it's even harder to catch the case of an aggregate init which also covers
struct padding vs. initializing all fields (but obviously not the padding).

Reply via email to