[flang-commits] [flang] c94c7cc - [Flang][OpenMP] Remove present modifier application on descriptor (#211856)
via flang-commits
flang-commits at lists.llvm.org
Wed Jul 29 20:18:05 PDT 2026
Author: agozillon
Date: 2026-07-30T05:18:00+02:00
New Revision: c94c7cc893d72dfa37c1cfe667ea9dac6da5e4a4
URL: https://github.com/llvm/llvm-project/commit/c94c7cc893d72dfa37c1cfe667ea9dac6da5e4a4
DIFF: https://github.com/llvm/llvm-project/commit/c94c7cc893d72dfa37c1cfe667ea9dac6da5e4a4.diff
LOG: [Flang][OpenMP] Remove present modifier application on descriptor (#211856)
This was a minor change upstreamed in the original PR:
https://github.com/llvm/llvm-project/pull/208133
However, it is a modification that needs a little more thought from a
specification perspective before it is rolled out, there's a number of
code bases that depend on the presence modifier being applied only to
the underlying data. However, this leads to inconsistencies when a user
makes use of any reference semantic modifiers when mapping as they
SHOULD be allowed to specify present applying to the descriptor. So, we
need to work out what the correct defualt behaviour is, and regardless
of the default support a user intentionally specifying presence
application on a descriptor via reference semantics.
For now, we will revert to previous state.
Added:
Modified:
flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
flang/test/Lower/OpenMP/defaultmap.f90
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp b/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
index 992ca8b94c5cb..949da8f20cbbe 100644
--- a/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
+++ b/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
@@ -761,8 +761,7 @@ class MapInfoFinalizationPass
return mapTypeFlag;
}
- flags |=
- MapFlags::to | (mapTypeFlag & (MapFlags::implicit | MapFlags::present));
+ flags |= MapFlags::to | (mapTypeFlag & MapFlags::implicit);
// Descriptors for objects will always be copied. This is because the
// descriptor can be rematerialized by the compiler, and so the address
diff --git a/flang/test/Lower/OpenMP/defaultmap.f90 b/flang/test/Lower/OpenMP/defaultmap.f90
index d43efdb3ad8ed..4877f0de07888 100644
--- a/flang/test/Lower/OpenMP/defaultmap.f90
+++ b/flang/test/Lower/OpenMP/defaultmap.f90
@@ -9,7 +9,7 @@ subroutine defaultmap_allocatable_present()
integer, dimension(:), allocatable :: arr
! CHECK: %[[MAP_1:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.box<!fir.heap<!fir.array<?xi32>>>) map_clauses(implicit, present) capture(ByRef) var_ptr_ptr({{.*}}) bounds({{.*}}) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
-! CHECK: %[[MAP_2:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.box<!fir.heap<!fir.array<?xi32>>>) map_clauses(always, implicit, present, to) capture(ByRef) members({{.*}}) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>> {name = "arr"}
+! CHECK: %[[MAP_2:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, !fir.box<!fir.heap<!fir.array<?xi32>>>) map_clauses(always, implicit, to) capture(ByRef) members({{.*}}) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>> {name = "arr"}
!$omp target defaultmap(present: allocatable)
arr(1) = 10
!$omp end target
More information about the flang-commits
mailing list