[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2026-05-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

--- Comment #9 from Drea Pinski  ---
Note bob is important for address sanitizers though.

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-08-11 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

--- Comment #8 from Richard Biener  ---
(In reply to Andrew Pinski from comment #7)
> No rethink that, it is only MEM[a+N] ones which we should remove.

It really depends on the type.  out-of-SSA stack sharing should only
look at whole object (aka whole decl) clobbers (not sure it actually
does this!).

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-08-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

--- Comment #7 from Andrew Pinski  ---
No rethink that, it is only MEM[a+N] ones which we should remove.

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-08-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=34949

--- Comment #6 from Andrew Pinski  ---
So PR 34949 is what kept around the clobbers here.
but that was before clobber_kind was added.

So if we have:
   MEM[(struct Vec *)&a] ={v} {CLOBBER(bob)};
   MEM[(struct Vec *)&a].val = _48;
   MEM[(struct Vec *)&a + 1B] ={v} {CLOBBER(bob)};
   MEM[(struct Vec *)&a + 1B].val = _48;
   MEM[(struct Vec *)&a + 2B] ={v} {CLOBBER(bob)};
   MEM[(struct Vec *)&a + 2B].val = _48;

since that is the begining of the object and the object is fully initialized,
removing the clobber for bob should be ok.

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-08-09 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

Andrew Pinski  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pinskia at gcc dot 
gnu.org
   Keywords||compile-time-hog
 Status|NEW |ASSIGNED

--- Comment #5 from Andrew Pinski  ---
  /* But only remove *this_2(D) ={v} {CLOBBER} if killed by
 another clobber stmt.  */
  if (gimple_clobber_p (stmt)
  && !by_clobber_p)
return;

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-07-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

--- Comment #4 from Andrew Pinski  ---
Maybe not 100% the same but I think it shows the issue:
```
struct s1
{
  int t;
  s1(int tt) : t(tt) {}
};

struct s2 : s1
{
  s2(int a) : s1(a){}
};

void g(s2*);


void f()
{
  s2 a[2]{s2(0), s2(1)};
  g(a);
}
```
In s2::s2, DSE is able to:
```
  Deleted dead store: *this_3(D) ={v} {CLOBBER(bob)};

void s2::s2 (struct s2 * const this, int a)
{
   :
  MEM[(struct s1 *)this_3(D)] ={v} {CLOBBER(bob)};
  MEM[(struct s1 *)this_3(D)].t = a_5(D);
```

And now the other thing is these are CLOBBER_OBJECT_BEGIN (BOB) rather than
CLOBBER_STORAGE_END (EOB) .

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-07-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

Andrew Pinski  changed:

   What|Removed |Added

   Severity|normal  |enhancement

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2025-07-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2025-07-25

--- Comment #3 from Andrew Pinski  ---
Confirmed.


   D.225026 ={v} {CLOBBER(eos)};
   MEM[(struct Vec *)&a] ={v} {CLOBBER(bob)};
-  MEM[(struct Vec *)&a] ={v} {CLOBBER(bob)};
-  MEM[(struct Vec *)&a] ={v} {CLOBBER(bob)};
-  MEM[(struct Vec *)&a] ={v} {CLOBBER(bob)};
-  MEM[(struct Vec *)&a] ={v} {CLOBBER(bob)};
   _48 = (unsigned char) invA_8;
   MEM[(struct Vec *)&a].val = _48;
   MEM[(struct Vec *)&a + 1B] ={v} {CLOBBER(bob)};
   MEM[(struct Vec *)&a + 1B].val = _48;
   MEM[(struct Vec *)&a + 2B] ={v} {CLOBBER(bob)};
-  MEM[(struct Vec *)&a + 2B] ={v} {CLOBBER(bob)};
   MEM[(struct Vec *)&a + 2B].val = _48;


still happens.
I would assume since (in this case) struct Vec is sizeof(1) and the store
`MEM[(struct Vec *)&a + 2B].val` stores the whole thing, then the clobber could
be removed too.

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2019-12-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

--- Comment #2 from Richard Biener  ---
But these are offsetted/partial clobbers, and we can't track address-taken on
parts...

[Bug tree-optimization/92750] DSE fails to remove all dead clobbers

2019-12-02 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92750

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
I believe even when the whole object that is clobbered is overwritten right
after it, the clobber is still useful, as it holds information in the IL that
the old value is gone and there is a new value.  E.g. if address of the var is
taken before the clobber, then there is clobber and then the whole object is
overwritten with another value, but nothing takes the address afterwards, e.g.
the tail-call optimization could be applied.