[flang-commits] [flang] [Flang][MLIR][OpenMP] Create a deferred declare target marking process for Bridge.cpp (PR #78502)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Mon Feb 26 03:42:58 PST 2024


================
@@ -2458,6 +2501,42 @@ bool Fortran::lower::isOpenMPDeviceDeclareTarget(
       ompDecl.u);
 }
 
+// In certain cases such as subroutine or function interfaces which declare
+// but do not define or directly call the subroutine or function in the same
+// module, their lowering is delayed until after the declare target construct
+// itself is processed, so there symbol is not within the table.
+//
+// This function will also return true if we encounter any device declare
+// target cases, to satisfy checking if we require the requires attributes
+// on the module.
+bool Fortran::lower::markOpenMPDeferredDeclareTargetFunctions(
+    mlir::Operation *mod,
+    llvm::SmallVectorImpl<OMPDeferredDeclareTargetInfo> &deferredDeclareTargets,
+    AbstractConverter &converter) {
+  bool deviceCodeFound = false;
+  auto modOp = llvm::dyn_cast<mlir::ModuleOp>(mod);
----------------
skatrak wrote:

```suggestion
  auto modOp = llvm::cast<mlir::ModuleOp>(mod);
```

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


More information about the flang-commits mailing list