https://bugs.llvm.org/show_bug.cgi?id=45864
Bug ID: 45864
Summary: Failure to optimize out check for (x * x) == 0 when (x
< -1 || x > 1)
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedb...@nondot.org
Reporter: gabrav...@gmail.com
CC: llvm-bugs@lists.llvm.org
#ifdef __clang__
#define assume __builtin_assume
#else
inline void assume(bool b)
{
if (!b)
__builtin_unreachable();
}
#endif
bool f(int x, bool cond)
{
assume(x > 1 || x < -1);
if (cond)
return (x * x) == 0;
else
return false;
}
This can be optimized to `return false;`. GCC does this transformation, but
Clang does not.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs