Closed
Description
Test Transforms/InstCombine/fabs.ll
shows the following transformation:
define double @select_fcmp_ole_zero(double %x) {
%lezero = fcmp ole double %x, 0.000000
%negx = fsub double 0.000000, %x, exceptions=ignore
%fabs = select i1 %lezero, double %negx, double %x
ret double %fabs
}
=>
define double @select_fcmp_ole_zero(double %x) {
%1 = fabs double %x, exceptions=ignore
ret double %1
}
This is not correct as fabs
produces a non-deterministic NaN payload, while the original function preserved the NaN payload when x > 0.