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

            Bug ID: 122178
           Summary: cselim should be able to handle clobbers too
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

as mentioned in
https://gcc.gnu.org/pipermail/gcc-patches/2025-October/696726.html .
cond_if_else_store_replacement_1 should be able to handle commonializing
clobbers; currently we don't.


Take:
```
#include <new>

struct s1
{
  int t;
};

void f(s1 *a, int b)
{
  if (b)
  {
    a = new(a)s1{1};
  }
  else
  {
    a = new(a)s1{0};
  }
}
```

This should be able to optimize at phiopt1.

Reply via email to