[flang-commits] [flang] [OpenMP][Flang] Add "IsolatedFromAbove" trait to omp.target (PR #67164)

Akash Banerjee via flang-commits flang-commits at lists.llvm.org
Thu Oct 5 07:14:30 PDT 2023


================
@@ -2433,10 +2502,44 @@ genTargetOp(Fortran::lower::AbstractConverter &converter,
                  Fortran::parser::OmpClause::Defaultmap>(
       currentLocation, llvm::omp::Directive::OMPD_target);
 
-  return genOpWithBody<mlir::omp::TargetOp>(
-      converter, eval, currentLocation, outerCombined, &clauseList,
-      ifClauseOperand, deviceOperand, threadLimitOperand, nowaitAttr,
-      mapOperands);
+  auto captureImplicitMap = [&](const Fortran::semantics::Symbol &sym) {
+    if (llvm::find(mapSymbols, &sym) == mapSymbols.end()) {
+      mlir::Value baseOp = converter.getSymbolAddress(sym);
+      if (!baseOp)
+        if (const auto *details = sym.template detailsIf<
+                                  Fortran::semantics::HostAssocDetails>()) {
+          baseOp = converter.getSymbolAddress(details->symbol());
+          converter.copySymbolBinding(details->symbol(), sym);
+        }
+
----------------
TIFitis wrote:

Hi, Thanks a lot for explaining the source of the error.

I am however struggling to code the solution for this as I am unfamiliar with the PFT lowering. Can you please tell me how to get the properties here and check if they are constant?

Also, I was able to add the extents as block arguments and it worked, but how do I get the original symbol(`Fortran::symantics::symbol`) for the extent values(`mlir::values`)? I need the symbols to bind them.

And is there any existing code which does something similar which I can use as reference? I wasn't able to find any.

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


More information about the flang-commits mailing list