[Bug tree-optimization/94884] New: Failure to recognize that result of or is always superior to operands
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Apr 30 12:52:22 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94884
Bug ID: 94884
Summary: Failure to recognize that result of or is always
superior to operands
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
bool decide() __attribute((const));
inline unsigned getXOrY(unsigned x, unsigned y)
{
return decide() ? y : x;
}
bool f(unsigned x, unsigned y)
{
return (x | y) >= getXOrY(x, y);
}
`f` can be optimized to `return true`. This transformation is done by LLVM, not
by GCC.
More information about the Gcc-bugs
mailing list