https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107053
Bug ID: 107053
Summary: ones bits is not tracked and popcount is not tracked
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
void link_failure();
void f(int a)
{
a |= 0x300;
int b = __builtin_popcount(a);
if (b < 3)
link_failure();
}
```
The if statement should be optimized away.
The reason is after the |, at least 3 bits are set in a.