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

    <tr>
        <th>Summary</th>
        <td>
            Missed Optimization: (f1 > 0 ? f1 : -f1) < (f2 > 0 ? f2 : -f2) —> fabs(f1) < fabs(f2)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Cancelll
      </td>
    </tr>
</table>

<pre>
    godbolt: https://godbolt.org/z/x14zx1EPs
alive2: https://alive2.llvm.org/ce/z/EUy5V5
```llvm
define i1 @src1(double %.11946, double %.11936) {
  %1 = fcmp oge double %.11936, 0.000000e+00
  %2 = fneg double %.11936
  %3 = select i1 %1, double %.11936, double %2
  %4 = fcmp oge double %.11946, 0.000000e+00
  %5 = fneg double %.11946
  %6 = select i1 %4, double %.11946, double %5
  %7 = fcmp olt double %3, %6
  ret i1 %7
}

define i1 @tgt1(double %.11946, double %.11936) local_unnamed_addr #0 {
  %abs11936 = tail call double @llvm.fabs.f64(double %.11936)
  %abs11946 = tail call double @llvm.fabs.f64(double %.11946)
  %cmp = fcmp olt double %abs11936, %abs11946
  ret i1 %cmp
}
```
The pattern is found here: https://github.com/dtcxzyw/llvm-opt-benchmark/blob/cb4e34a37f79854522d0721f3fb2023e63c83f67/bench/openblas/optimized/dhgeqz.ll#L2383-L2389
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVE1v4zYQ_TWjCxGBHJKSddDB-dCpRXtoe12Q0tBWS0uuSGeT_PqCjJX1xtkAXcMQ7NF7w8f3yDEhjLuJqAV9C_q-MKe4n5f2zkw9ee8LOw_P7W4e7OwjyC3bx3gMILeAHWB3flHOyw6wewHsnoR6eRIPvwfgW-PHR8Jr1mu99P7xcGb2dKY__Pms_9LAt1Dx129CAd8O5MaJ2CgYKB6WXgBuhvlkPTFAXQrRqArwjn1fkxVgw6C-Bb5lqSgYyHvm-sORzTv6AH3HeMnzhwBvOV-J-EqcaHdNOkNkhgTy1McsFLX4WNJlDVe6-kya-kSa_pE09SatupamrqW9d1Cv9PpCmo8XCJkIqX9GLrQ2r1OC9X16vosu7uL_ic7PvfFfTtNkDjR8McOwMEDJLyM1NmR41hjN6FlvvH_rpvIJKp2xoXSVulo7r_N9L_WzvdRlr-TWD2xbJZ_dW1d9Z2J_OH6zcb0OwLd_7IkdTYy0TGwMzM2naWB7WuiD-znG_cmW_XwA7IbYP708fwXs0i5u5mO8sTT1-4NZ_gHsrJ9tuopWkVRG1q5uNlppxIHXKJx0FjlKqmS_ka6qEyOxAbv5SJP1JuSfcTyMLzSk9fY7-vel9B5Q_oJyI2_SsymGVg6NbExBraiVFHIjuSr2bWVNr11lSDbWNVKTq4QmrawgJ40VxdgiR80lbrjmmqtSC97oxjipbK25cqA4Hczo30ZLMYZwolZIKau68MaSD3nSIU70leW3gJgG39JmV-xpF1LOY4jhW5s4Rk_tr2MINLDfXvdo4jhPyXLAjUtz5YFxBrJj-c-W3TiRh4-8ywi8ROAZgRnxgLDh0KgESGcrN1y5ayFBi9Pi208SzrPyHO9xmf-mPgJ2eZcpnLMNjy3-FwAA__9Ii6wG">