[flang-commits] [flang] [mlir] [flang][OpenACC] Attach `OpenACCLoopLocAttr` to `acc.loop` op (PR #208238)

Moazin K. via flang-commits flang-commits at lists.llvm.org
Wed Jul 8 09:01:11 PDT 2026


================
@@ -182,4 +182,19 @@ subroutine data_end_locations(arr)
     !CHECK-LABEL: acc.copyout
     !CHECK-SAME:  loc("{{.*}}locations.f90":181:11)
   end subroutine
+
+  subroutine acc_kernel_with_loop_locations(arr)
+    real, dimension(10) :: arr
+    integer :: i
+
+    !$acc kernels
+    do i = 1, 10
+      arr(i) = arr(i) + 1
+    end do
+    !$acc end kernels
+  end subroutine
+
+! CHECK-LABEL: func.func @_QMacc_locationsPacc_kernel_with_loop_locations
+! CHECK: acc.loop
+! CHECK: } attributes {{.*}} loc(fused<#acc.loop_loc<loops = loc("{{[^"]*}}locations.f90":191:5)>>["{{[^"]*}}locations.f90":191:5])
----------------
moazin wrote:

I could add a separate `CHECK-NOT` but I think this `CHECK` covers that too:
```mlir
#acc.loop_loc<loops = loc("{{[^"]*}}locations.f90":191:5)>
```
if there is a `directive = ` along with the `loops = `, it'll fail this check. 

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


More information about the flang-commits mailing list