<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/141538>141538</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Wrong folding to `fabs`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bongjunj
</td>
</tr>
</table>
<pre>
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
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0VUGv2zYM_jXKhXiBTNlJfPAhr68BdtrwVmzYKZBtytGbLAWSnCb59YNsN2keurY7zBCchORH8iMZSoagO0tUseKZFS8LOcSD81XtbPc22LdF7dpLtTX6RAiejs5HJrZwiPEYmNgy3DHcyVG9NObUL53vGO4aYri7Mtzp3-xfjWJ8m86KTycZTqKnn3wY37aktCVQxskILOeBDDVxb620e6ut2ttw3aumP86icN07E_eWuit5t0SGmxmLxZlhCWz9nJJAwRMRvk0KhiIDJl4gOQLX3eKNmA_wxJd8fJJ9klrqzhMgDDWkyGDDdUbdrfHD5GJGKVmHETWRmHHaqhGssy-pJNwtgRTqQXBzx1DglETye9OnX6OJp3iXJuPEe_2S3uKFiY__R3WtU54IPmtjPMXBW-ipd_7CcGOdpW824LEDictjYd4xf08ru9H65KUNyvleRu0stI6CZbiOcCKv1YVhNo3fx9fXX1_TPP8hzUDQ69DL2Bxm5Vn2R0NTbvfQY3IMxZnPDzDcMHzmS86wnKC_u8E3M_LezRsySTbZZP3Q3h_6fujtz1vfBuQHeX-SvqP4jvFD6puvwE836MQXTqmKqZzfCzPFeLT9ttfkeOh76S9f5oND47xP_5j40OFpzDPQ9nt6DkpqQ-1TdE9H7070L1bztiPvnQ9f760pp18C6AjSAp2P1ERqoaaDPGnnQTkP8UCQVmqtI0QHyugjE7uEg3jQ9u_0DpCOjd61Q0MteGrIRnMB5V3_brl2Oh6Getm4nuFu3JzTR6LwRk1M29b1vU5f2kyU-bpuV41UeY5Zkcm8FqrISNCmRlw1eckLUSzaSrSlKOWCqmydb0SWrdf54lC1GbXlGmUhULUqqwUXnHieExaqEIQLXSHHghe45shLkS9XbV7meSOxqEup2g3LOfVSm9ttsNAhDFRleVaIzcLImkwYLxtES59h1DLEdPf4aiRWD11gOTc6xHB3E3U0VP3pne1AOdNq26X6shUf99yKLwZvqv9cuzF-YLibEzxV-E8AAAD__4vfEmg">