https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118804
Bug ID: 118804
Summary: redundant if (x == CST && y == CST) not removed
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: denis.campredon at gmail dot com
Target Milestone: ---
foo and bar in the following exemple should produce similar assembly:
------
bool f(int , int );
bool bar (int x, int y) {
if (x == y)
return true;
if (x == 999 && y == 999)
return true;
return f(x,y);
}
bool foo (int x, int y) {
if (x == y)
return true;
return f(x,y);
}
-----
But gcc does not recognize that if (x == 999 && y == 999) is redundant because
if (x == y) already covers that case.