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

    <tr>
        <th>Summary</th>
        <td>
            [LoopIdiomRecognize] Only optimization for initialize zero
        </td>
    </tr>

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

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

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

<pre>
    * test: https://gcc.godbolt.org/z/zo3b9rMdj
```
void foo_memset0 (float dest[N], int n)
{
    // #pragma clang loop vectorize(assume_safety)
    for (int k=0; k<10; k++)
    for (int j = 0; j < n; j++) {
        dest[j] = 0;
    }
}

void foo_memset1 (float * __restrict dest, float * __restrict src, int n)
{
 // #pragma clang loop vectorize(assume_safety)
    for (int k=0; k<10; k++)
    for (int j = 0; j < n; j++) {
        dest[j] = 1;
 }
}
```

* We can see that there is obvious different output assembles between the initialize zero and initialize One.
  > For initialize zero, it is recognized as a memset , and then eliminate the out loop 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUVE-PuzYQ_TTmMtrIGAjJgUP-NFKltiv10mNk7IE4NXZkD1ltPn1lQvafot5_kQMP7DfP88aMjNH0DrFh1ZZV-0yOdPKhuXa667LW6_eGiQ0QRmLFBk5El8iKDRMHJg69Uove69ZbWvjQM3G4pb8v2nX4U58Z3zO-YUs-j-nx6o2GzvvjgENE4sDEqrNeEuikUW3_YtWeiR0YR-CYWM9R6u0dAADc1YGJ4hJkP0hQVroerPcXuKIiH8wNmVjJGMcBj1F2SO8foVKEzocknDT-ZcWes2KbwC6fkdhO4znjDKzYw7QywR24CX6Q4Ntm029O7cyq_Qf3Szr1_pHkAzyzKv-0KpXkeAwYKRg1Oyd28HQyBvV_dv7yXuafXj4x8vvhm69iA_8gKOkgIgKdJAGdMCCYCL69Gj9G0KbrMKAj8CNdRgIZIw6txQgt0huiSxwwzpCR1twQbhg8SKe_vnt1uHhsnxW_wcGHn5SpOJSkAyrfO3NDDTKChHvZIS1IYemEDtCawThJOKn7ke6VynRT6HWxlhk2eS0Er5erVZmdmqoqa1UqvdRYdp1qS4XLleqqVnR5qesiM43gouS1qHNe5qJc6GUt2lXOZS55UQrNSo6DNHZh7XVIn3lmYhyxyTlfLcvMyhZtnLqHEA7fYJplQqRmEppEemnHPrKSWxMpfoYhQ3ZqO394f_ldGz_8_TAg1fbV2XfwFzKDuUky3k3H5od52Rhs86MpGTqN7UL5gYlDEptvL5fgz6iIicO0xcjEYc7h2oj_AgAA__97A3x8">