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

    <tr>
        <th>Summary</th>
        <td>
            nontemporal instructions not generated for #pragma omp simd nontemporal 
        </td>
    </tr>

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

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

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

<pre>
    For the following program, compiler is expected to generate nontemporal instructions

void test(int *ArrayPt, int *Pointer, int n)
{
#pragma omp simd nontemporal(ArrayPt,Pointer)
  for (int i=0;i<n;i++) {
     *ArrayPt += *Pointer;
     ArrayPt++;
     Pointer++;
   }
}

Yes, the non-temporal instructions are generated at O0 (on x86 platform).
used the option : clang -fopenmp <test.c>
        movntiq %rax, -8(%rbp)
        movq    -16(%rbp), %rax
        addq    $4, %rax
        movntiq %rax, -16(%rbp)

At O1 and above, the nontemporal hint seem to be ignored and the non-temporal instructions are not getting generated.
        movdqu  %xmm2, (%rdi,%rcx,4)
        movdqu  %xmm0, 16(%rdi,%rcx,4)

Is it expected behavior?. I think the nontemporal metadata is not getting propagated incase of optimizations. The meta data seem to get dropped at SROA pass.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVE2PmzAQ_TXmMgoiBifhwCG7aaQ97artpUcbvOAWbGKbbNpf3zFJCPtVFSFsY8-bN29mLEz1u9gbC76R8Gza1rwoXUNvTW15R-g9lKbrVSstKAfy1MvSywq8gVpqabmXoI32suuN5S0o7bwdSq-MdiTZkWR7_h6NQiPpPKEbpT0Qut1ay38_-eDi8ufJ4ETa6x9NaH7BWN9dJjTtLa87DkgKnOqquXfEvoFOYBcMwOgsXNwrku4Skt7heK_Hkd6Nbw6TLwjPjSeE_XQ355nOT06eR6BXWxOVt1tkvbsGuJur9UO6IEJICYa3-FBd4FZOOaiAe3hMQnhGw2mzgr7lHgPGDObxGXRwIW8IafoAACTdQtlyTPbi2fRSo6CoRshRXJL0y4w_Pp05aq8O6IBZfgrkFht0Fpain2k8nT6EcbFcvTqEZheAV8d5VR3OYmfZZ2c-IPAGfKbfFsVYAtcoizBHOdNykrIJZeCk7EIpCwmq1sYGHXX1H7pr41F770OrTDmI3zGuDkOIip26jp4DG_lWWG73YVKGQLKP5JtZJsFyivUz2_P3wYHyty4VsuFHZbBS9zE8YFxK_3qnRCc9r7jnob_nceEV0PN6LC6lS-6wcJ7H2unUHz5KEcN3xAr2MAJc5UQEqNC6P9flt6-PW-i5c3FUFWmVpzmPvPKtLD67OS48rrV9btx_dT5Eg22LxvveYVkTuse3Vr4ZRIzXFy7a9ngdFhjYT9QHl8q5IbTanrE1W0dNwRndLNcrUWZMpmy5FmKViNUqX4plthE8iVouZOsKwrCVqZYvMELgnLBdpAqaUJowmidZlrA0TuiGMlamYskTyfIVyRLZcdXGgUdsbB3ZYqQkhtrhZqucd7dNlAzLUsrRHeLzwTfGFq5RR46XM8ePiUYCxRjAXxcwyVo">