[Bug tree-optimization/101591] New: (a|b) ==/!= a -> (b & ~a) ==/!= 0 on gimple
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 23 04:02:26 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101591
Bug ID: 101591
Summary: (a|b) ==/!= a -> (b & ~a) ==/!= 0 on gimple
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:
bool f(unsigned a, unsigned b)
{
return (a|b) == a;
}
This should be optimized to:
bool f(unsigned a, unsigned b)
{
return (b & ~a) ==/!= 0;
}
It might be only best if you we do for constant b's though.
More information about the Gcc-bugs
mailing list