https://bugs.llvm.org/show_bug.cgi?id=49161
Bug ID: 49161
Summary: Failure to optimize comparison of float with itself
when it's converted to double and -ftrapping-math is
on
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
bool f(float x)
{
return x == (float)(double)x;
}
This can be optimized with `return x == x;`, even with `-ftrapping-math` (at
least according to GCC). This transformation is done by GCC, but not by LLVM.
Godbolt comparison: https://godbolt.org/z/TdozY4
(if someone knows how to do alive2 checks for stuff that involves floating
point comparisons, I would be glad to know)
--
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