[flang-commits] [flang] [Flang][MLIR] - Access the LEN for a `fir.boxchar<k>` and use it to set the bounds `omp.map.info` ops. (PR #134967)
via flang-commits
flang-commits at lists.llvm.org
Mon Apr 14 16:21:35 PDT 2025
================
@@ -268,8 +274,54 @@ static void bindEntryBlockArgs(lower::AbstractConverter &converter,
cloneBounds(v.getLBounds())));
},
[&](const fir::CharBoxValue &v) {
- converter.bindSymbol(
- sym, fir::CharBoxValue(arg, cloneBound(v.getLen())));
+ // In some cases, v.len could reference the input to the
+ // hlfir.declare which is the corresponding v.addr. While this isn't
+ // a big problem by itself, it is desirable to extract this out of
+ // v.addr itself since it's first result will be of type
+ // fir.boxchar<>. For example, consider the following
+ //
+ // func.func private @_QFPrealtest(%arg0: !fir.boxchar<1>)
+ // %2 = fir.dummy_scope : !fir.dscope
+ // %3:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) ->
+ // (!fir.ref<!fir.char<1,?>>, index)
+ // %4:2 = hlfir.declare (%3#0, %3#1, %2):(!fir.ref<!fir.char<1,?>>,
+ // index,!fir.dscope) ->
+ // (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
+
+ // In the case above,
+ // v.addr is
+ // %4:2 = hlfir.declare (%3#0, %3#1, %2):(!fir.ref<!fir.char<1,?>>,
+ // index,!fir.dscope) ->
+ // (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
+ // v.len is
+ // %3:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) ->
+ // (!fir.ref<!fir.char<1,?>>, index)
+
+ // Mapping this to the target will create a use of %arg0 on the
+ // target. Since omp.target is IsolatedFromAbove, %arg0 will have to
----------------
agozillon wrote:
https://github.com/llvm/llvm-project/blob/main/flang/lib/Lower/OpenMP/OpenMP.cpp#L1371 this is the segment I believe, we map or clone across dependencies on the bounds
https://github.com/llvm/llvm-project/pull/134967
More information about the flang-commits
mailing list