[flang-commits] [flang] [llvm] [mlir] [OpenMP] Honor barrier and last iteration flags in loop lowering (PR #224040)

Nicole Aschenbrenner via flang-commits flang-commits at lists.llvm.org
Fri Sep 25 00:43:25 PDT 2026


================
@@ -260,3 +263,15 @@ subroutine omp_taskloop_lastprivate()
    ! CHECK:  omp.terminator
    !$omp end taskloop
 end subroutine omp_taskloop_lastprivate
+
+! CHECK-LABEL:  func @_QPomp_taskloop_first_and_lastprivate()
+subroutine omp_taskloop_first_and_lastprivate()
+   integer x
+   x = 0
+   ! CHECK:  omp.taskloop.context private(@[[FIRST_LAST_PRIVATE_X]] {{.*}}) {
----------------
nicebert wrote:

The existing check already covers this: the `private_barrier` attribute would be emitted between the closing `)` and the opening `{` of the region, so requiring `) {` fails if it's there. I can make that explicit if you prefer, which would be:

```
! CHECK:  omp.taskloop.context private(@[[FIRST_LAST_PRIVATE_X]] {{.*}})
! CHECK-NOT:  private_barrier
! CHECK-SAME:  {
```

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


More information about the flang-commits mailing list