<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/128457>128457</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] wrong folding of `select (fcmp ...) (frem ...) C`
        </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>
    https://alive2.llvm.org/ce/z/Ee6vRd


```llvm

----------------------------------------
define float @select_fcmp_frem(float %x) {
#0:
  %fcmp = fcmp oeq float %x, 3.000000
  %frem = frem float %x, 2.000000
  %sel = select i1 %fcmp, float %frem, float 1.000000
  ret float %sel
}
=>
define float @select_fcmp_frem(float %x) {
#0:
  ret float 1.000000
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
float %x = #x40400000 (3)

Source:
i1 %fcmp = #x1 (1)
float %frem = #xbf800000 (-1)
float %sel = #xbf800000 (-1)

Target:
Source value: #xbf800000 (-1)
Target value: #x3f800000 (1)

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyslM1uozAQx5_GXKwgMwYCBw5pU6Q9rZSu9loZGIgrg7O2Sdt9-pVNPit1tYdFKDGe33j-HntGWCuHCbEi2QPJtpGY3V6bqtHT8DpPr1Gju49q79zBEr4hUBOohZJHhFip4xhrMxCoWyRQ_yZQP2F-3HWEbU5vzpbXs8vU6h8fwjYd9nJC2istHCUps6iwdS99Ox5eeoMjgeJkg-ydQEnJ-sEHAc68Vrah3uJxSviWhoHGX_TW6ZHymIXnwhscF94P7ln4xFpUAV2UUZmcA3r44rpoPU8kt2sYdFfOovLy11v_y7eEP_2fJFyD3MRewvwwYrK9NqNwUk-002gnAmtHj2hk_0EgWU7tabf7viN8Q38KNSMdpR2Fa_cn47sYDwqXcFcxITME-HvK0hCVEig4gXLxetazaU9O18RdnPxMkSz0XSYvRNMXl2VXn8nzyXwF-r0LM6BbBCxi6NHvzm_zK7fF557jN9x19ed5HIX5OJ8Bo602xl8Sd5dyG6wJldPf7Iz2QirsVk6vDkYf8QtqEyqTojHa2Nv6i7qKdyUvRYRVsk4ZXydJwaJ9VTQo1nnZZZB3XZ_kHWdMAJbImyYDYJGsgEHGAFKWQg4sxpJleS_6hqMoUlaSlOEopLr0g0haO2OVQJFm60iJBpUN3QVgwjcarATANxtTeadVMw-WpExJ6-x1GSedCm3p22Tdox4bOSHJtvTN6GmgvVadnAaqe0ryU1X4EwiXKI7jUApQhBtz-nz0iZiN-tTOBun2cxO3eiRQh0a1_PlMv2LrCNRBsyVQnzZ1rOBPAAAA___P6oBi">