Open
Description
It was difficult to title the issue. Feel free to modify it appropriately.
Consider the following functions:
bool f_and(int x,int y)
{
bool a = x == 0;
bool b = y == 0;
bool t = a & b;
return t & !a;
}
bool f_or(int x,int y)
{
bool a = x != 0;
bool b = y != 0;
bool t = a | b;
return t | !a;
}
The function f_and
can be optimized to 0, and f_or
can be optimized to 1.
https://godbolt.org/z/nWq194nz9
https://alive2.llvm.org/ce/z/PPCfP9
FYI (original issue)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111542