[Bug tree-optimization/83041] redundant assignment from member array not eliminated

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 20 08:38:00 GMT 2017


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

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2017-11-20
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Both references get alias-set zero.  Given we do not know the dynamic type of
there can be very well a struct A live at that point which means p might point
to a.  For g there cannot be a B at a because it won't fit.

We do not figure the "redundant" assignments because we're not able to
CSE p->a[0] to the previous a[0] store.  This "trick" is not implemented.

I think we have a duplicate bug for this looking like

void foo (int *p, int *q)
  *p = 1;
  *q = 1;
  return *p;

which we should be able to optimize to return 1.

More information about the Gcc-bugs mailing list