GCC Bugzilla – Bug 35691
Missed (a == 0) && (b == 0) into (a|(typeof(a)(b)) == 0 when the types don't match
Last modified: 2010-03-02 18:40:14 UTC
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.