[flang-commits] [flang] [NFC][flang][OpenMP] `do concurrent` to device mapping lit tests (PR #155992)
Kareem Ergawy via flang-commits
flang-commits at lists.llvm.org
Sun Sep 14 00:51:21 PDT 2025
================
@@ -0,0 +1,29 @@
+! Verifies that proper `omp.map.bounds` ops are emitted when an allocatable is
+! implicitly mapped by a `do concurrent` loop.
+
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fdo-concurrent-to-openmp=device %s -o - \
+! RUN: | FileCheck %s
+program main
+ implicit none
+
+ integer,parameter :: n = 1000000
+ real, allocatable, dimension(:) :: y
+ integer :: i
+
+ allocate(y(1:n))
+
+ do concurrent(i=1:n)
+ y(i) = 42
+ end do
+
+ deallocate(y)
+end program main
+
+! CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %{{.*}} {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFEy"}
+! CHECK: %[[Y_VAL:.*]] = fir.load %[[Y_DECL]]#0
+! CHECK: %[[Y_DIM0:.*]]:3 = fir.box_dims %[[Y_VAL]], %{{c0_.*}}
----------------
ergawy wrote:
Indeed. However, the difficulty of this is that there are constants spread across the IR. So I would have to match all the preceeding constants which will add noise to the test expectations.
Here, I chose instead to match against the constant names as printed by MLIR which I think is stable enough and should be clear that we are matching a 0 or 1 constant based on the name: `c0_...` or `c1_...`. Let me know if you still think this is a bad idea.
https://github.com/llvm/llvm-project/pull/155992
More information about the flang-commits
mailing list