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

    <tr>
        <th>Summary</th>
        <td>
            Missed optimization: saturated adds are missed if the selections are flipped
        </td>
    </tr>

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

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

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

<pre>
    For:

return x + 9 > x ? x + 9 : -1;

LLVM doesn't condense this to a saturated add. It only does for 

return x < ~9 ? x + 9 : -1;

This is because the saturated add folds do not actually cover all possible forms.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8kkGv2yAMxz8NuViNEihtc-DQ7i3SpPdu0-4OOC0TCREm3brDPvtEM2l7O0xCAuG__YO_jcz-OhMZoS9Cv1S45ltM5pwx-ZdEOHE1RPcwfUxCnUVTVqK8phm-g5AX6ECoj-Ws-r9uzrBrhbps-tfXL2_gIvEs5DGDjbOjmQnyzTPkCAiMeU2YyQE6V8OnDHEOj2cOjDHBv1z1AX52_0N-LqU9w0AW1yeK3kNgjMExuAhzzIA2rxjCA2y8UwIMAZbI7IdAhT9xXTmjXKc6rMi0R9k2h6ZVsroZa_V4QNTHoVN7h04OdDrSaRgbq7tW28ob2ch9c2x1e2i1amrao5ZOtWPX6E62J7FvaEIf6hDuUx3TtfLMK5nu1EldBRwo8LM9Us70DZ5BIWXpVjIlZzesVxb7JnjO_KdK9jmQefPM5CAu2U_-B2Yf5-LVOzMYMBFMm9KPm1sUyBb1FhyDXxZy1ZqCueW8cJkG2QvZX32-rUNt4yRkX-C_t92S4leyWcj--WQWst--dDfyVwAAAP__MzvJMw">