<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71130>71130</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
missed optimization for "length" of (a, b)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Consider the following function.
https://godbolt.org/z/PfhEMPT3z
```cpp
bool lenzero(int a, int b) {
return (b < a ? 0 : b - a + 1) == 0;
}
```
In the function `lenzero`, `(b < a ? 0 : b - a + 1)` represents the "length" of a given set of integers (a, b). In that sense, I don't think this function is too artificial.
Alive2:
https://alive2.llvm.org/ce/z/z4jYgg
Original GCC bugzilla issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102138
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEU81u8zYQfJrVZWGBP7Z-Djo4dlXkUDSHXnoqKGlFMaFJg6Ri1E9fSFaaIO2HDxBILcUZzmi4KkajHVEDhyc4nDM1p8mH5m2nQvC3mHV--Ls5eRfNQAHTRDh6a_3NOI3j7PpkvMuBnYEdp5SuEeQRRAui1X7ovE25DxpEewfRvozTL7-9_CHvj-1QsMfTX6-Plc57i5bcnYIHURmXUIE44fLSgagRyqfHTkQMlObgEETVIcgTKgTZIkOQR-xwt9TiCfkKk2eQZ2QgNziU528atnIdn93D5-YOoWAfogq26Fmnnx4LBcNA10CRXIorJQhhyek0gRDoR1SozTs5jJSW0rhEmkJcTK3GF9M5rnpUwkgu0rL8jIN3IMqEaTLubRnjp1wTMXmPKiQzmt4om381d7TmncSS0v9kptaPubXvly23nrbw7vvXP7X-yvR7MNo4ZfHX0wm7Wd-NtQpNjDP9gF73fa7dvFF_QEC0cfK3v7pZ5702IFszgDxzJrissqGRQy1rlVHDi7qqy0KUPJuagte8VGOhlOqqmqthL8pxPFBRDgMfWJWZRjAhOWeS8QPnPK-YKsa-I1ZXqqhJwZ7RRRn7r91s1d6UnEuWWdWRjWtXCOHothkTYmmS0CyYXTfrCHtmTUzxkyWZZKm5mBhpQH9N5mLuak1m9OE_V-Br1NkcbPPtl5k0zV3e-wuIdjlim3bX4F-pTyDaVVgE0a7C_wkAAP__fBAkRw">