Bug 35691 - Missed (a == 0) && (b == 0) into (a|(typeof(a)(b)) == 0 when the types don't match
Missed (a == 0) && (b == 0) into (a|(typeof(a)(b)) == 0 when the types don't ...
Status: NEW
Product: gcc
Classification: Unclassified
Component: middle-end
4.4.0
: P3 enhancement
: ---
Assigned To: Not yet assigned to anyone
: missed-optimization
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-03-25 04:31 UTC by Andrew Pinski
Modified: 2010-03-02 18:40 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-03-02 18:40:14


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2008-03-25 04:31:50 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.