While looking into PR 35429, I noticed this small missed optimization.
If we have:
typedef unsigned int1;
int foo(int z0, int1 z1)
{
return z0 != 0 || z1 != 0;
}
int foo1(int z0, int1 z1)
{
return z0 == 0 && z1 == 0;
}
--- CUT ---
Both of those should optimize as int is the same size as unsigned and we are
comparing against 0. The same thing should happen with int and long on a ILP32
target.
--
Summary: Missed (a == 0) && (b == 0) into (a|(typeof(a)(b)) == 0
when the types don't match
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35691