[flang-commits] [clang] [flang] [flang][OpenMP] Upstream `do concurrent` loop-nest detection. (PR #127595)

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Sat Feb 22 03:15:32 PST 2025


kiranchandramohan wrote:

There is a separate completeness issue as well. Currently, some do-concurrent programs with internal branches (eg below) will be treated as unstructured loops and not modelled as `fir.do_loop`. The conversion pass will miss these. So having an operation modelling do-concurrent (that is not a single block) might benefit this as well. Alternatively, if you want to skip these kinds of loops, please call it out in the document.

```
program internal_branch
  integer, parameter :: N = 10
  integer :: i, array(N)
  array =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

  do concurrent (i = 1:N)
    if(mod(array(i),2) .eq. 0) then
      cycle
    else
      array(i) = array(i) - 1
    end if
  end do

  print *, array
end program
```

https://github.com/llvm/llvm-project/pull/127595


More information about the flang-commits mailing list