<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121287>121287</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Flang][OpenMP] Instruction does not dominate all uses!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
flang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Reproducible on Godbolt:
https://godbolt.org/z/d3Go49zoz
Reproducer:
```f90
program main
implicit none
integer, parameter :: na = 10
integer, parameter :: nb = 20
integer, parameter :: nc = 30
integer :: a(na, nb), b(na, nb, nc), t(na, nb, nc)
integer :: s
integer :: i, j, k
do k = 1, nc
do j = 1, nb
do i = 1, na
b(i, j, k) = i * j + j * k + i * k
t(i, j, k) = b(i, j, k)
end do
end do
end do
a = 0
!$omp parallel do reduction(+:a)
do j = 1, nb
do i = 1, na
a(i, j) = a(i, j) + sum(b(i, j, :))
end do
end do
do k = 1, nc
do j = 1, nb
do i = 1, na
if (b(i, j, k) /= t(i, j, k)) then
print *, "error: i=", i, "j=", j, "k=", k, " is ", &
b(i, j, k), " should be ", t(i, j, k)
stop 1
end if
end do
end do
end do
end program main
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVU-PuzYQ_TTDxdrIDJDAgQPZiFUPVat-A4NN4sTYyDZbdT99ZSCbf7Taww9FxLw388bPYwxzTh61ECVke8gOERv9ydjy8sasNX-7qDH8n_IvMVjDx1Y2ShCjyYfhjVEekgpodfJ-cGGINWB9nKmNsUfA-guw5smHSYsv8wU0hF-1hJ3TYUvnX1dQoNVgzdGynvRMaqAVIYTIflCylZ5oo8UV014chQV8JwOzrBdeWBIEk4poRiA5kJj-JLaZYvFHse0UmzzFXmkGmGsWMnUDWIRB8wC9E90uhF8lVmXdOixD2jncLvO6hhhuyGX2vojO8EKd76jmjlpoeUezQIfZ35fBYoqQBLAKYrif7lWoifsFvzwJh8uvC73qP-UKzQk3d-AD8P2wPM9dpwsAGAOmph-mPiolVPBoBR9bL40GzAH3kFTsVvY_l2htcdjd5Gc7TwjuiRt7wPzR5vSiFPde_9fUr-3owyU78jK7uTdYh7zXrgXSn4ReaTEhg5Xahy0wuUQU1ho779TkAIgBlgt3vkHnBbrcoMsCEenIAgFuV4uGa2UbLfnuZEbFSSOuMiuW1lSdNwOJX6jQG9kF-IcbMwyezrPv0y7iZcKLpGCRKONdkqXbNI5pdCq3bZvlKW53uMu6Nu6abUrzmKdtwfMua3kkS6SYxogFLTDO6CbJ2m6Xs0LsOpq12wZSKnom1Uapzz4cxJF0bhRljDHmu0ixRig3nfeInWL6GFYnO0S2DAlvzXh0kFIlnXc3CS-9mj4S9ZSRHSDb_zEI_fufkB3Ib9p5O79ZhBvhiDaecNNLzbwgTCkyOuEA42i0qnz6Ykh_GptNa3rAOtRb_t4Ga86i9YD1NH8HWC8WPkv8NwAA__870sKz">