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

    <tr>
        <th>Summary</th>
        <td>
            [flang][OpenMP] Lowering crashes for composite distribute simd constructs with private clause
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang
      </td>
    </tr>

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

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

<pre>
    After recent changes to the lowering of composite do simd constructs, programs like the following no longer ignore the simd information.

```
program main
 integer, allocatable :: tmp
  allocate(tmp)
  !$omp teams distribute simd private(tmp)
  do i=1, 10
    tmp = tmp + 1
  end do
end program
```
Instead, they crash with:

```
error: loc("/repr.f90":4:9): 'omp.distribute' op loop wrapper does not contain exactly one nested op
error: verification of lowering to FIR failed
```
This only happens when the privatised variable needs a non-trivial privatiser, because delayed privatisation is not handled correctly.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxkU9Gu4ygM_RryYt2KkKZtHvKQu1WlkXa1q9X-AAUnYYZgBG67_fsRae90dK-ERGKwfQ7nWOfspoDYi_ZdKLWkH_o7sg5RKCXaY6UvPFPqX_HqTPbeDyNjgoQGA4OZdZgwAxPwjODphsmFCWgEQ0uk7BjBEmS3WDAUMqeL4SzUHxATTUkvGbz7gWv2SN7TraQHAk9hwgRuCpQex2sNF0ZKi2ZHYSPkUNZOPpccnjVh0S4IOYALjBOm0k57T0azPnsE0QyiGYCXWC59HKFQhxJS3RoVqhZqS0sExgLTuszJnS_8RBKTu35JsgRONMe6dKzlGoLSB0RzfOzqHeo1jsGCJSGH8vEE_onOt5AZtS3FeMY7mKTzDDfHc2HwhT2mRKkQ82SEOhQZ1SlhTJuxk-WvGbaiGboCthlAqD0tcfPiJdQeKIIninBLOkZMYAkzBOIiHmsXAP_Xhv0dKCAEzIwWKP7e_IrJjc6sEhUf_PIEE5y-_Qujdh7tJ-j_zS4DBX-HufQNGW4zhlX2xzu7jBauOrlVwIBoM2gIFN44uavT_nVvlfuMRl8ygkWv72h_nT5guQenWQfrsRgzJSysNpXtG9s1na6wr_dts-86uTtUc69rJU2n0XSjsefdrja1lLtOjofDtq67feV6JVUr96qrt2qr9ptu27ZWH1qp9o0ddS22Ehft_Mb767KhNFUu5wv2dVvXbVd5fUafn7M4eh2m5ximviS8nS9TFlvpXeb8KsGO_TrAj4z2KNr3vyOGv_4R7RH-_Hj61TiYYaT0-1x-cvRrPlePfTgcjC9PWV2S72fmmIv51Emo0-R4vpw3hhahTgXTc3uLib6jYaFOK8cs1OlJ89qrnwEAAP__vqp25w">