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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64][SVE][Question] incorrect fold of SVE's svwhilele?
        </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>
    The following test case is taken from gcc bugzilla.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117045.

```cpp
#include <arm_sve.h>
#include <limits.h>
svbool_t f() { return svwhilele_b8_s32(INT_MAX, INT_MAX); }
```
https://godbolt.org/z/vecxznE48

Gcc:
```asm
f():
 ptrue   p0.b, all
 ret
```

Clang:
```asm
f():
        ptrue   p0.b, vl1
 ret
```

If bugzilla's comment is correct, clang's code is incorrect. I'm not sure if clang is wrong, but can someone check this?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU01vpDgQ_TXFpRQEBho4cOiPsMphV1olWu2tZUwB3hi7ZZvunfz6kbuZJNPKYQYhY_zKVa-qXnHn5KiJGih2UBwivvjJ2Ob1gVtrLi7qTP-teZkIB6OUuUg9oifnUXBHKB16_koaB2tmHIXAbhnfpFI8huQAyfaZCCfvTw6yLbAWWDsKEY96iY0dgbU_zIG1bjKXY7eMsRglZK3sITukaZnkxeprXTfJ7RWn03rCMqmFWnpCyPbczkd3pniC7PErXMlZevcJdufOGHX0OACrgNUI5Q4t-cVqdOfLJBUpOnbV0WUMWPX018vxz-2_wPb4vq0h2yGUhzuGt9-79E3fGeXX9N-AtWcS_7_px7z6nOUfQoQrP_vjbr6drEzfLfDk7UKIeEriLjDjSq2IJf8lq9u6V1yPvxNofe7jnVX6S_GeBvzoeOlQmHkm7YOOhLGWhA_exJXVDe-vIpN6hWN8AlbOqI1Ht1hCOdzMg9XFmnBvj90S9KnRmZmMJhQTiVf0k3SQtVHfZH2d1TyiJi1ZXWzSpGbR1NRpVVVDWSYVr8tNT3ldlnmepnmRdKwceCQblrA8TRhL0qxKWdzzzZCneV3zshMDbSBPaOZSxUqd59DiSDq3UJOmGcvzSPGOlLsOGmOaLnhFgbEwd7YJlx66ZXSQJ0o67z7ceOnVdUK3WyumTQ7FAYrd8z-Pt83fCzkvjYbi8FGqMLA9mgGDWSjmu5hDERarmjtlSj8tXSzMDKwNkdfPw8ma_66daa98HbB2TejcsO8BAAD__wDJP5o">