https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127053
Bug ID: 127053
Summary: cselim_limited could be improved to skip over one
clobber on either branch
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
This shows up with std::optional:
```
#include <optional>
void func(std::optional<int> &x) {
x.reset();
}
```
In phiopt1 we have:
```
if (_4 != 0)
goto <bb 3>; [50.00%]
else
goto <bb 4>; [50.00%]
<bb 3> :
MEM[(struct _Optional_payload_base *)x_2(D)]._M_engaged = 0;
MEM[(int *)x_2(D)] ={v} {CLOBBER(eob)};
goto <bb 5>; [100.00%]
<bb 4> :
MEM[(struct _Optional_payload_base *)x_2(D)]._M_engaged = 0;
<bb 5> :
```
Only the DR based cselim handles this currently because of the clobber.