Issue 141538
Summary Wrong folding to `fabs`
Labels new issue
Assignees
Reporter bongjunj
    Alive2 report: https://alive2.llvm.org/ce/z/iPnYcf

```llvm

----------------------------------------
define float @select_nnan_ninf_nsz_fcmp_nnan_nsz_olt_negzero.2(float %x) {
#0:
 %#1 = fcmp oge float %x, -0.000000
  %negx = fsub nnan nsz float -0.000000, %x
  %fabs = select nnan ninf nsz i1 %#1, float %negx, float %x
  %#2 = fabs float %fabs
  ret float %#2
}
=>
define float @select_nnan_ninf_nsz_fcmp_nnan_nsz_olt_negzero.2(float %x) nofree willreturn memory(none) {
#0:
  %#1 = fabs nnan ninf nsz float %x
  ret float %#1
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
float %x = #x00000000 (+0.0)

Source:
i1 %#1 = #x1 (1)
float %negx = #x00000000 (+0.0)
float %fabs = #x00000000 (+0.0)
float %#2 = #x00000000 (+0.0)

Target:
float %#1 = #x80000000 (-0.0)
Source value: #x00000000 (+0.0)
Target value: #x80000000 (-0.0)

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```

Is it an expected behavior for the signbit to flip?
I think this is introduced recently from https://github.com/llvm/llvm-project/commit/d13947bd6caf442151a4b3f51e3e8b226c490535
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to